ok thanks,
*****************************************************
first: lazy = false
Reception maReception = (Reception)this.loadObject(new Integer(receptionId));
------------------------------------------------------------------
Hibernate: select etatrece1_.ID_ETAT_RECEPTION as ID_ETAT_RECEPTION0_, etatrece1_.LIBELLE as LIBELLE0_, fourniss2_.ID_FOURNISSEUR as ID_FOURNISSEUR1_, fourniss2_.LIBELLE as LIBELLE1_, fourniss2_.ID_MAGASIN as ID_MAGASIN1_, operatio3_.ID_OPERATION_SPECIALE as ID_OPERATION_SPECIALE2_, decode (operatio3_.ID_OPERATION_SPECIALE, operatio3__1.ID_OPERATION_SPECIALE, 1, operatio3__2.ID_OPERATION_SPECIALE, 2,0 ) as clazz_2_, operatio3_.LIBELLE as LIBELLE1_2_, operatio3__2.ID_PAYS as ID_PAYS3_2_, receptio0_.ID_RECEPTION as ID_RECEPTION3_, receptio0_.NUM_COMMANDE as NUM_COMM2_3_, receptio0_.NUM_RECEPTION as NUM_RECE3_3_, receptio0_.DATE_COMMANDE as DATE_COM4_3_, receptio0_.DATE_1_RECEPTION as DATE_1_R5_3_, receptio0_.COURS_OR_FACTURE as COURS_OR6_3_, receptio0_.COURS_OR_AUCHAN as COURS_OR7_3_, receptio0_.NBR_PRODUIT_FACTURE as NBR_PROD8_3_, receptio0_.MONTANT_FACTURE as MONTANT_9_3_, receptio0_.ID_MAGASIN as ID_MAGASIN3_, receptio0_.ID_ETAT_RECEPTION as ID_ETAT11_3_, receptio0_.ID_FOURNISSEUR as ID_FOUR12_3_, receptio0_.ID_OPERATION_SPECIALE as ID_OPER13_3_ from REC_RECEPTION receptio0_, REC_ETAT_RECEPTION etatrece1_, STK_FOURNISSEUR fourniss2_, STK_OPERATION_SPECIALE operatio3_, STK_OP_MAGASIN operatio3__1, STK_OP_NATIONALE operatio3__2 where receptio0_.ID_RECEPTION=? and receptio0_.ID_ETAT_RECEPTION=etatrece1_.ID_ETAT_RECEPTION(+) and receptio0_.ID_FOURNISSEUR=fourniss2_.ID_FOURNISSEUR(+) and receptio0_.ID_OPERATION_SPECIALE=operatio3_.ID_OPERATION_SPECIALE(+) and operatio3_.ID_OPERATION_SPECIALE=operatio3__1.ID_OPERATION_SPECIALE(+) and operatio3_.ID_OPERATION_SPECIALE=operatio3__2.ID_OPERATION_SPECIALE(+)
Hibernate: select magasin0_.ID_MAGASIN as ID_MAGASIN__, magasin0_.ID_MAGASIN as ID_MAGASIN, magasin0_.LIBELLE_MAGASIN as LIBELLE_2_ from MAGASIN magasin0_ where magasin0_.ID_OPERATION_SPECIALE=?
Hibernate: select pays0_.ID_PAYS as ID_PAYS, pays0_.LIBELLE_PAYS as LIBELLE_2_ from PAYS pays0_ where pays0_.ID_PAYS=?
------------------------------------------------------------------
when i look on the variable debug window, i have operationSpeciale= com.auchan.protoj2ee.bo.OpMagasin (id=253)
+ magasins= net.sf.hibernate.collection.Bag (id=258)
additions= null
bag= java.util.ArrayList (id=260)
collectionSnapshot= net.sf.hibernate.impl.SessionImpl$CollectionEntry (id=265)
directlyAccessible= false
initialized= true
session= net.sf.hibernate.impl.SessionImpl (id=220)
in the bag, i have the magasin....
*****************************************************
second: lazy = true
Reception maReception = (Reception)this.loadObject(new Integer(receptionId));
------------------------------------------------------------------
Hibernate: select etatrece1_.ID_ETAT_RECEPTION as ID_ETAT_RECEPTION0_, etatrece1_.LIBELLE as LIBELLE0_, fourniss2_.ID_FOURNISSEUR as ID_FOURNISSEUR1_, fourniss2_.LIBELLE as LIBELLE1_, fourniss2_.ID_MAGASIN as ID_MAGASIN1_, operatio3_.ID_OPERATION_SPECIALE as ID_OPERATION_SPECIALE2_, decode (operatio3_.ID_OPERATION_SPECIALE, operatio3__1.ID_OPERATION_SPECIALE, 1, operatio3__2.ID_OPERATION_SPECIALE, 2,0 ) as clazz_2_, operatio3_.LIBELLE as LIBELLE1_2_, operatio3__2.ID_PAYS as ID_PAYS3_2_, receptio0_.ID_RECEPTION as ID_RECEPTION3_, receptio0_.NUM_COMMANDE as NUM_COMM2_3_, receptio0_.NUM_RECEPTION as NUM_RECE3_3_, receptio0_.DATE_COMMANDE as DATE_COM4_3_, receptio0_.DATE_1_RECEPTION as DATE_1_R5_3_, receptio0_.COURS_OR_FACTURE as COURS_OR6_3_, receptio0_.COURS_OR_AUCHAN as COURS_OR7_3_, receptio0_.NBR_PRODUIT_FACTURE as NBR_PROD8_3_, receptio0_.MONTANT_FACTURE as MONTANT_9_3_, receptio0_.ID_MAGASIN as ID_MAGASIN3_, receptio0_.ID_ETAT_RECEPTION as ID_ETAT11_3_, receptio0_.ID_FOURNISSEUR as ID_FOUR12_3_, receptio0_.ID_OPERATION_SPECIALE as ID_OPER13_3_ from REC_RECEPTION receptio0_, REC_ETAT_RECEPTION etatrece1_, STK_FOURNISSEUR fourniss2_, STK_OPERATION_SPECIALE operatio3_, STK_OP_MAGASIN operatio3__1, STK_OP_NATIONALE operatio3__2 where receptio0_.ID_RECEPTION=? and receptio0_.ID_ETAT_RECEPTION=etatrece1_.ID_ETAT_RECEPTION(+) and receptio0_.ID_FOURNISSEUR=fourniss2_.ID_FOURNISSEUR(+) and receptio0_.ID_OPERATION_SPECIALE=operatio3_.ID_OPERATION_SPECIALE(+) and operatio3_.ID_OPERATION_SPECIALE=operatio3__1.ID_OPERATION_SPECIALE(+) and operatio3_.ID_OPERATION_SPECIALE=operatio3__2.ID_OPERATION_SPECIALE(+)
------------------------------------------------------------------
OpMagasin op = (OpMagasin)maReception.getOperationSpeciale();
when i look on the variable debug window, i have op= com.auchan.protoj2ee.bo.OpMagasin (id=227)
libelleOperationSpeciale= "OP ARNO"
magasins= net.sf.hibernate.collection.Bag (id=231)
additions= null
bag= null
collectionSnapshot= net.sf.hibernate.impl.SessionImpl$CollectionEntry (id=242)
directlyAccessible= false
initialized= false
session= net.sf.hibernate.impl.SessionImpl (id=220)
operationSpecialeId= java.lang.Integer (id=239)
here the bag is null --> lazy seems to be working fine
then
Magasin tmp = (Magasin)(op.getMagasins().get(0));
------------------------------------------------------------------
Hibernate: select magasin0_.ID_MAGASIN as ID_MAGASIN__, pays1_.ID_PAYS as ID_PAYS0_, pays1_.LIBELLE_PAYS as LIBELLE_2_0_, magasin0_.ID_MAGASIN as ID_MAGASIN1_, magasin0_.LIBELLE_MAGASIN as LIBELLE_2_1_ from MAGASIN magasin0_, PAYS pays1_ where magasin0_.ID_OPERATION_SPECIALE=? and magasin0_.ID_MAGASIN=pays1_.ID_PAYS(+)
Hibernate: select pays0_.ID_PAYS as ID_PAYS, pays0_.LIBELLE_PAYS as LIBELLE_2_ from PAYS pays0_ where pays0_.ID_PAYS=?
------------------------------------------------------------------
Now, i look idiot because i don't know why but it works now.... we have
tmp= com.auchan.protoj2ee.bo.Magasin (id=248)
idMagasin= java.lang.Integer (id=256)
libelleMagasin= "V2"
pays= null
As you can see, the query generated is asking to load the pays "attribute", you can see in the mapping file that we have an outer-join. And even if the query seems ok, the result is that pays = null
<hibernate-mapping>
<class name="com.auchan.protoj2ee.bo.Magasin" table="MAGASIN">
<id column="ID_MAGASIN" name="idMagasin" >
<generator class="assigned">
</generator>
</id>
<property column="LIBELLE_MAGASIN" name="libelleMagasin" not-null="true" />
<many-to-one name="pays" column="ID_PAYS" class="com.auchan.protoj2ee.bo.Pays" outer-join="false" />
</class>
</hibernate-mapping>
if we "force" by doing Pays test = tmp.getPays(); test is null but another query is lanched:
------------------------------------------------------------------
Hibernate: select etatrece1_.ID_ETAT_RECEPTION as ID_ETAT_RECEPTION0_, etatrece1_.LIBELLE as LIBELLE0_, fourniss2_.ID_FOURNISSEUR as ID_FOURNISSEUR1_, fourniss2_.LIBELLE as LIBELLE1_, fourniss2_.ID_MAGASIN as ID_MAGASIN1_, operatio3_.ID_OPERATION_SPECIALE as ID_OPERATION_SPECIALE2_, decode (operatio3_.ID_OPERATION_SPECIALE, operatio3__1.ID_OPERATION_SPECIALE, 1, operatio3__2.ID_OPERATION_SPECIALE, 2,0 ) as clazz_2_, operatio3_.LIBELLE as LIBELLE1_2_, operatio3__2.ID_PAYS as ID_PAYS3_2_, receptio0_.ID_RECEPTION as ID_RECEPTION3_, receptio0_.NUM_COMMANDE as NUM_COMM2_3_, receptio0_.NUM_RECEPTION as NUM_RECE3_3_, receptio0_.DATE_COMMANDE as DATE_COM4_3_, receptio0_.DATE_1_RECEPTION as DATE_1_R5_3_, receptio0_.COURS_OR_FACTURE as COURS_OR6_3_, receptio0_.COURS_OR_AUCHAN as COURS_OR7_3_, receptio0_.NBR_PRODUIT_FACTURE as NBR_PROD8_3_, receptio0_.MONTANT_FACTURE as MONTANT_9_3_, receptio0_.ID_MAGASIN as ID_MAGASIN3_, receptio0_.ID_ETAT_RECEPTION as ID_ETAT11_3_, receptio0_.ID_FOURNISSEUR as ID_FOUR12_3_, receptio0_.ID_OPERATION_SPECIALE as ID_OPER13_3_ from REC_RECEPTION receptio0_, REC_ETAT_RECEPTION etatrece1_, STK_FOURNISSEUR fourniss2_, STK_OPERATION_SPECIALE operatio3_, STK_OP_MAGASIN operatio3__1, STK_OP_NATIONALE operatio3__2 where receptio0_.ID_RECEPTION=? and receptio0_.ID_ETAT_RECEPTION=etatrece1_.ID_ETAT_RECEPTION(+) and receptio0_.ID_FOURNISSEUR=fourniss2_.ID_FOURNISSEUR(+) and receptio0_.ID_OPERATION_SPECIALE=operatio3_.ID_OPERATION_SPECIALE(+) and operatio3_.ID_OPERATION_SPECIALE=operatio3__1.ID_OPERATION_SPECIALE(+) and operatio3_.ID_OPERATION_SPECIALE=operatio3__2.ID_OPERATION_SPECIALE(+)
java.lang.NullPointerException
at com.auchan.protoj2ee.bo.DAOHibernateReception.rechercherReception(DAOHibernateReception.java:159)
at com.auchan.protoj2ee.bdl.ReceptionServiceBDL.rechercherReception(ReceptionServiceBDL.java:47)
at com.auchan.protoj2ee.bdl.ReceptionSessionBDL.rechercherReception(ReceptionSessionBDL.java:60)
at com.auchan.protoj2ee.navigation.action.reception.SecondeReceptionAction.execute(SecondeReceptionAction.java:42)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at com.auchan.fwk.technique.utilitaire.mvc.struts.ActionServlet.process(ActionServlet.java:101)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:505)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at com.auchan.fwk.technique.utilitaire.mvc.dao.hibernate.HibernateActionFilter.doFilter(HibernateActionFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:87)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)
2004-02-24 18:11:48,203 INFO [Thread-10] action.RequestProcessor (RequestProcessor.java:225) - Processing a 'GET' for path '/exception'
2004-02-24 18:11:48,265 INFO [Thread-10] logging.Logger (Logger.java:609) - Non connect
|