2012-07-17 42 views
1

在我的開發環境中,當我運行一個ReadAllQuery,使用一個簡單的獲取所有JQPL查詢時,我注意到使用EL分析器後,有幾個讀取對象查詢得到執行,每個添加時間到我的總數時間。例如,像這樣運行查詢將返回以下eclipse配置文件輸出。EclipseLink Profiler顯示多個註冊對象正在創建

@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=,[email protected],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,[email protected],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=,[email protected],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=,[email protected],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[email protected]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, 
) 

回答

1

由記錄設置致設置爲FINEST