1

在我的开发环境中,当我使用简单的获取所有 JQPL 查询运行 ReadAllQuery 时,我注意到在使用 EL 分析器后,有几个读取对象查询会被执行,每次都会增加我的总时间。例如,运行这样的查询会返回以下 Eclipse 配置文件输出。

@SuppressWarnings("unchecked")
public List<Person> getAllPeople(){
    EntityManager entityManager = factory.createEntityManager();
    List<Person> people = null;
    try {
        people = entityManager.createQuery("Select p from Person p where p.active = true").getResultList();
    } catch (Exception e) {
        // TODO: handle exception
    }
    finally{
        entityManager.close();
        if (entityManager.isOpen()) {
        }
    }

返回多个Register the existing object语句并查看日志输出,每个语句都在一个工作单元中完成,为什么以及如何防止这些?

[EL Finest]: connection: 2012-07-16 20:21:26.558--ServerSession(1144634498)--Connection(1713234840)--Thread(Thread["http-bio-8080"-exec-14,5,main])--Connection released to connection pool [read].
Profile(ReadAllQuery,
    class=org.bixin.dugsi.domain.ApplicantSchool,
    number of objects=2,
    total time=3494000,
    local time=3494000,
    profiling time=84000,
    Timer:Logging=412000,
    Timer:ObjectBuilding=1670000,
    Timer:SqlPrepare=24000,
    Timer:ConnectionManagement=215000,
    Timer:StatementExecute=455000,
    Timer:Caching=68000,
    Timer:DescriptorEvents=9000,
    Timer:RowFetch=97000,
    time/object=1747000,
)
}End profile
Register the existing object Address[id=5,persons={[Applicant[major=Bachelors in Islamic Studies,nativeLanguage=<null>,ethnicity=<null>,hispanic=<null>,religiousAffiliation=<null>,schools={[ApplicantSchool[id=8,name=John Hopkisn,fromMonth=May,fromYear=2013,toMonth=March,toYear=2011,schoolType=Highschool,creditsCompleted=unavailable,gpa=unavailable,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>], ApplicantSchool[id=7,name=,fromMonth=<null>,fromYear=<null>,toMonth=<null>,toYear=<null>,schoolType=College,creditsCompleted=,gpa=,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>]]},FirstName=warsame,MiddleName=a,LastName=bashir,primaryTelephone=2342342333,secondaryTelephone=,emailAddress=warsme@d.com,birthDay=Sun Jul 22 00:00:00 CDT 2012,gender=Male,DateAdded=Fri Jul 13 18:16:33 CDT 2012,address=<null>,imagePath=<null>,active=true,marital=Single,school=<null>,nativeLanguage=Arabic,ethnicity=[Asian],hispanic=No,religiousAffiliation=Islam,id=651,version=1,_persistence_school_vh={null},_persistence_address_vh={Address[id=5,persons=org.eclipse.persistence.indirection.IndirectSet@47f322c8,streetAddress=243 city join,streetAddress2=<null>,city=saudi,state_us=South Carolina (SC),zipCode=24234,country=Antarctica,version=1,_persistence_fetchGroup=<null>]},_persistence_fetchGroup=<null>]]},streetAddress=243 city join,streetAddress2=<null>,city=saudi,state_us=South Carolina (SC),zipCode=24234,country=Antarctica,version=1,_persistence_fetchGroup=<null>]
Profile(
    total time=5000,
    local time=5000,
    Timer:DescriptorEvents=5000,
)
Profile(
    total time=196000,
    local time=196000,
    Timer:Register=196000,
)
[EL Finest]: transaction: 2012-07-16 20:21:26.564--UnitOfWork(26103836)--Thread(Thread["http-bio-8080"-exec-14,5,main])--Register the existing object Applicant[major=Bachelors in Islamic Studies,nativeLanguage=<null>,ethnicity=<null>,hispanic=<null>,religiousAffiliation=<null>,schools={[ApplicantSchool[id=8,name=John Hopkisn,fromMonth=May,fromYear=2013,toMonth=March,toYear=2011,schoolType=Highschool,creditsCompleted=unavailable,gpa=unavailable,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>], ApplicantSchool[id=7,name=,fromMonth=<null>,fromYear=<null>,toMonth=<null>,toYear=<null>,schoolType=College,creditsCompleted=,gpa=,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>]]},FirstName=warsame,MiddleName=a,LastName=bashir,primaryTelephone=2342342333,secondaryTelephone=,emailAddress=warsme@d.com,birthDay=Sun Jul 22 00:00:00 CDT 2012,gender=Male,DateAdded=Fri Jul 13 18:16:33 CDT 2012,address=<null>,imagePath=<null>,active=true,marital=Single,school=<null>,nativeLanguage=Arabic,ethnicity=[Asian],hispanic=No,religiousAffiliation=Islam,id=651,version=1,_persistence_school_vh={null},_persistence_address_vh={Address[id=5,persons={[Applicant[major=Bachelors in Islamic Studies,nativeLanguage=<null>,ethnicity=<null>,hispanic=<null>,religiousAffiliation=<null>,schools={[ApplicantSchool[id=8,name=John Hopkisn,fromMonth=May,fromYear=2013,toMonth=March,toYear=2011,schoolType=Highschool,creditsCompleted=unavailable,gpa=unavailable,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>], ApplicantSchool[id=7,name=,fromMonth=<null>,fromYear=<null>,toMonth=<null>,toYear=<null>,schoolType=College,creditsCompleted=,gpa=,applicant=<null>,version=1,_persistence_applicant_vh={QueryBasedValueHolder: not instantiated},_persistence_fetchGroup=<null>]]},FirstName=warsame,MiddleName=a,LastName=bashir,primaryTelephone=2342342333,secondaryTelephone=,emailAddress=warsme@d.com,birthDay=Sun Jul 22 00:00:00 CDT 2012,gender=Male,DateAdded=Fri Jul 13 18:16:33 CDT 2012,address=<null>,imagePath=<null>,active=true,marital=Single,school=<null>,nativeLanguage=Arabic,ethnicity=[Asian],hispanic=No,religiousAffiliation=Islam,id=651,version=1,_persistence_school_vh={null},_persistence_address_vh=org.eclipse.persistence.internal.indirection.QueryBasedValueHolder@6b8099d3,_persistence_fetchGroup=<null>]]},streetAddress=243 city join,streetAddress2=<null>,city=saudi,state_us=South Carolina (SC),zipCode=24234,country=Antarctica,version=1,_persistence_fetchGroup=<null>]},_persistence_fetchGroup=<null>]
Profile(
    total time=1349000,
    local time=1349000,
    Timer:Logging=1349000,
)
4

1 回答 1

1

由设置为的日志记录设置引起FINEST

于 2012-07-21T22:14:37.590 回答