-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
 Post subject: A LazyInitializationException, helppp
PostPosted: Mon Aug 29, 2005 4:07 am 
Newbie

Joined: Fri Jun 24, 2005 5:34 am
Posts: 18
Hibernate version:
3.0

Hy all,

I've got a "E org.hibernate.LazyInitializationException failed to lazily initialize a collection of role: xx.db.TStore.storeBy - no session or session was closed"

Here is my mapping :

<hibernate-mapping package="xx.db">
<class name="TStore" table="v_Store">
<id name="id" column="StoreID" />
<property name="manager" column="Manager" />
<property name="storeGroup" column="StoreGroupID" />

<map name="storeBy" table="v_Article_Store" >
<key column="StoreID" />
<index-many-to-many class="TStore"
column="DepositID">
</index-many-to-many>
<many-to-many class="TArticle">
<column name="SAPRef"></column>
<column name="EANCode"></column>
</many-to-many>
</map>
</hibernate-mapping>


My TABLE containes more than 1000 Stores and more than 50000 Articles. If i set a lazy="true" parameter, my web page never load :(


Top
 Profile  
 
 Post subject: Re: A LazyInitializationException, helppp
PostPosted: Mon Aug 29, 2005 4:26 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
blins wrote:
E org.hibernate.LazyInitializationException failed to lazily initialize a collection of role: xx.db.TStore.storeBy - no session or session was closed

Well, the exception quite clearly states what you're doing wrong.
Post your code for which the exception occurs. Otherwise we can hardly help you.

Are you using the OpenSessionInView pattern?
http://www.hibernate.org/43.html

blins wrote:
My TABLE containes more than 1000 Stores and more than 50000 Articles. If i set a lazy="true" parameter, my web page never load :(

You probably mean lazy="false".

Best regards
Sven

_________________
Please don't forget to give credit, if this posting helped to solve your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 4:43 am 
Newbie

Joined: Fri Jun 24, 2005 5:34 am
Posts: 18
thx sven to quicly answer me, has you asked me I post the exception occurs (but i'm not sure it will help you to help me ;)):

Code:
[29/08/05 10:40:42:359 CEST] 5db32739 SystemOut     O Hibernate: select distinct tstore2_.StoreID as col_0_0_ from v_Store tstore0_, v_Article_Store articlesto1_, v_Store tstore2_ where tstore0_.StoreID=articlesto1_.StoreID and articlesto1_.DepositID=tstore2_.StoreID
[29/08/05 10:40:48:219 CEST] 5db32739 SystemOut     O Hibernate: select tstore0_.StoreID as StoreID, tstore0_.Name as Name4_, tstore0_.Telephone as Telephone4_, tstore0_.LanguageCode as Language4_4_, tstore0_.Email as Email4_, tstore0_.Fax as Fax4_, tstore0_.Manager as Manager4_, tstore0_.StoreGroupID as StoreGro8_4_ from v_Store tstore0_ where tstore0_.StoreID=?
[29/08/05 10:40:48:266 CEST] 5db32739 LazyInitializ E org.hibernate.LazyInitializationException  failed to lazily initialize a collection of role: be.uchrony.recall.db.TStore.storeBy - no session or session was closed
[29/08/05 10:40:48:281 CEST] 5db32739 LazyInitializ E org.hibernate.LazyInitializationException  TRAS0014I: L'exception suivante a été consignée : org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: be.uchrony.recall.db.TStore.storeBy - no session or session was closed
    at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:191)
    at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:183)
    at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:48)
    at org.hibernate.collection.PersistentMap.keySet(PersistentMap.java:165)
    at be.uchrony.recall.db.impl.StoreImp.isStoresBy(StoreImp.java:340)
    at pagecode.jsp.admin.Recall_find_store.isSelected(Recall_find_store.java:528)
    at pagecode.jsp.admin.Recall_find_store.setDepositFromDB(Recall_find_store.java:427)
    at pagecode.jsp.admin.Recall_find_store.doAutoFilter(Recall_find_store.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
    at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
    at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
    at javax.faces.component.UIInput.broadcast(UIInput.java:492)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:252)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:310)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
    at be.uchrony.recall.FakeFilter.doFilter(FakeFilter.java:98)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
    at be.uchrony.recall.LoginFilter.doFilter(LoginFilter.java:90)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
    at be.uchrony.recall.HibernateFilter.doFilter(HibernateFilter.java:43)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1010)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:592)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
    at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
    at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
    at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
    at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:449)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)
.
                                 org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: be.uchrony.recall.db.TStore.storeBy - no session or session was closed
    at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:191)
    at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:183)
    at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:48)
    at org.hibernate.collection.PersistentMap.keySet(PersistentMap.java:165)
    at be.uchrony.recall.db.impl.StoreImp.isStoresBy(StoreImp.java:340)
    at pagecode.jsp.admin.Recall_find_store.isSelected(Recall_find_store.java:528)
    at pagecode.jsp.admin.Recall_find_store.setDepositFromDB(Recall_find_store.java:427)
    at pagecode.jsp.admin.Recall_find_store.doAutoFilter(Recall_find_store.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
    at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
    at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
    at javax.faces.component.UIInput.broadcast(UIInput.java:492)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:252)
    at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:310)
    at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:79)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:76)
    at be.uchrony.recall.FakeFilter.doFilter(FakeFilter.java:98)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
    at be.uchrony.recall.LoginFilter.doFilter(LoginFilter.java:90)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
    at be.uchrony.recall.HibernateFilter.doFilter(HibernateFilter.java:43)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:132)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:71)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1010)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:592)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:204)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:125)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:286)
    at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
    at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
    at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
    at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:615)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:449)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:912)



I'm also using a OpenSession :
Code:
public void doFilter(ServletRequest request, ServletResponse response,
  FilterChain filterChain) throws IOException, ServletException {
    if(this.filterConfig==null) return;
    try{
      boolean openHibernateSession = false;
      if(request instanceof HttpServletRequest){
        String path = ((HttpServletRequest)request).getRequestURI();
        if(path.endsWith(".jsp")||
           path.endsWith(".faces")){
          openHibernateSession = true;
        }
      } else {
        /* not a Http request, we do not know if
           hibernate is needed. In doubt, open session. */
        openHibernateSession = true;
      }
      if(openHibernateSession){
        HibernateUtils.initSession();
        filterChain.doFilter(request, response);
        HibernateUtils.closeSession();
      } else {
        filterChain.doFilter(request, response);       
      }
    } catch (Exception exception){
      throw new ServletException(exception);
    }


Kind regards
Blins


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 4:53 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Where do you try to access storeBy in your code?
Post the corresponding part of your code.

Best regards
Sven

_________________
Please don't forget to give credit, if this posting helped to solve your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 5:05 am 
Newbie

Joined: Fri Jun 24, 2005 5:34 am
Posts: 18
Code:
public StoreImp implements Store{
   private TStore store;
   //  [ ... ]
   public boolean isStoresBy(Store depot) {
       if (depot != null) {
           Map stores = getStoreBy();
   
           if (stores != null) {
               Iterator it = stores.keySet().iterator();
               while (it.hasNext()) {
                   Store store = FacadePattern.getStoreInstance();
                   store.setStore((TStore) it.next());
                   if (depot.getId().equals(store.getId()))
                       return true;
               }
           }
       }
       return false;
   }
}


When the page is loaded the first time, I get all "Store", and if i change my status, i try to know if "Store" i get in my session are "StoreBy" another Store.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 5:30 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Make sure that you're using the same Hibernate session when trying to access the stores.

If you cannot ensure that you're using the same session, you might use a simple HQL query in order to retrieve the stores.

Alternatively you might disable lazy fetching for this association.
Code:
<map name="storeBy" table="v_Article_Store" lazy="false">
...
</map>


See:
http://www.hibernate.org/hib_docs/v3/re ... ns-mapping

Best regards
Sven

_________________
Please don't forget to give credit, if this posting helped to solve your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 5:48 am 
Newbie

Joined: Fri Jun 24, 2005 5:34 am
Posts: 18
I know that the problem is a Session problem, but, how I can keep the current Session in a web session ?

I've set the "Lazy=false" and in my Console I've got all the time

Code:
[29/08/05 11:44:44:516 CEST] 5cadae64 SystemOut     O Hibernate: select tarticle0_.SAPRef as SAPRef0_, tarticle0_.EANCode as EANCode0_, tarticle0_.DescriptionFR as Descript3_18_0_, tarticle0_.DescriptionNL as Descript4_18_0_, tarticle0_.LotNumber as LotNumber18_0_, tarticle0_.SSCCode as SSCCode18_0_, tarticle0_.Category as Category18_0_, tarticle0_.Price as Price18_0_, tarticle0_.Brand as Brand18_0_, tarticle0_.DallasRef as DallasRef18_0_, tarticle0_.GIBRef as GIBRef18_0_, tarticle0_.SupplierID as SupplierID18_0_ from v_Article tarticle0_ where tarticle0_.SAPRef=? and tarticle0_.EANCode=?
[29/08/05 11:44:44:562 CEST] 5cadae64 SystemOut     O Hibernate: select tarticle0_.SAPRef as SAPRef0_, tarticle0_.EANCode as EANCode0_, tarticle0_.DescriptionFR as Descript3_18_0_, tarticle0_.DescriptionNL as Descript4_18_0_, tarticle0_.LotNumber as LotNumber18_0_, tarticle0_.SSCCode as SSCCode18_0_, tarticle0_.Category as Category18_0_, tarticle0_.Price as Price18_0_, tarticle0_.Brand as Brand18_0_, tarticle0_.DallasRef as DallasRef18_0_, tarticle0_.GIBRef as GIBRef18_0_, tarticle0_.SupplierID as SupplierID18_0_ from v_Article tarticle0_ where tarticle0_.SAPRef=? and tarticle0_.EANCode=?
[29/08/05 11:44:44:609 CEST] 5cadae64 SystemOut     O Hibernate: select tarticle0_.SAPRef as SAPRef0_, tarticle0_.EANCode as EANCode0_, tarticle0_.DescriptionFR as Descript3_18_0_, tarticle0_.DescriptionNL as Descript4_18_0_, tarticle0_.LotNumber as LotNumber18_0_, tarticle0_.SSCCode as SSCCode18_0_, tarticle0_.Category as Category18_0_, tarticle0_.Price as Price18_0_, tarticle0_.Brand as Brand18_0_, tarticle0_.DallasRef as DallasRef18_0_, tarticle0_.GIBRef as GIBRef18_0_, tarticle0_.SupplierID as SupplierID18_0_ from v_Article tarticle0_ where tarticle0_.SAPRef=? and tarticle0_.EANCode=?
[29/08/05 11:44:44:656 CEST] 5cadae64 SystemOut     O Hibernate: select tarticle0_.SAPRef as SAPRef0_, tarticle0_.EANCode as EANCode0_, tarticle0_.DescriptionFR as Descript3_18_0_, tarticle0_.DescriptionNL as Descript4_18_0_, tarticle0_.LotNumber as LotNumber18_0_, tarticle0_.SSCCode as SSCCode18_0_, tarticle0_.Category as Category18_0_, tarticle0_.Price as Price18_0_, tarticle0_.Brand as Brand18_0_, tarticle0_.DallasRef as DallasRef18_0_, tarticle0_.GIBRef as GIBRef18_0_, tarticle0_.SupplierID as SupplierID18_0_ from v_Article tarticle0_ where tarticle0_.SAPRef=? and tarticle0_.EANCode=?
[29/08/05 11:44:44:703 CEST] 5cadae64 SystemOut     O Hibernate: select tarticle0_.SAPRef as SAPRef0_, tarticle0_.EANCode as EANCode0_, tarticle0_.DescriptionFR as Descript3_18_0_, tarticle0_.DescriptionNL as Descript4_18_0_, tarticle0_.LotNumber as LotNumber18_0_, tarticle0_.SSCCode as SSCCode18_0_, tarticle0_.Category as Category18_0_, tarticle0_.Price as Price18_0_, tarticle0_.Brand as Brand18_0_, tarticle0_.DallasRef as DallasRef18_0_, tarticle0_.GIBRef as GIBRef18_0_, tarticle0_.SupplierID as SupplierID18_0_ from v_Article tarticle0_ where tarticle0_.SAPRef=? and tarticle0_.EANCode=?


I mean, my page never load correclty with lazy=false...


I thank's your for the time you spend on my problem, sven.


Top
 Profile  
 
 Post subject: little detail
PostPosted: Mon Aug 29, 2005 5:54 am 
Newbie

Joined: Fri Jun 24, 2005 5:34 am
Posts: 18
I forgot a detail :

Store is a view in my DB contains an id, name, an so...
There is a relational table of Article_Store with an Article ID, a Store ID and a DepositID.... StoreID and DepositID are pointed to the "Store" table.

In fact, a store can be a deposit and a deposit can be store.

So with LaZy = false, when Hibernate found a Store he make the storeBy and found a Deposit, make the storeBy and found a Store, and hibernate become crazy ;) (like me)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 6:06 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Well, you can keep it in your web application like this:

Code:
request.getSession().putValue(String key, Object value);
// e.g.: request.getSession().putValue("hibernateSession", hbSession);


But -using the OpenSessionInView pattern- the filter will close your session when the page has been rendered.
Though be careful with storing your HB session in your HTTP request.

See: http://www.hibernate.org/168.html
Quote:
A session is not thread-safe. Things which are supposed to work concurrently, like HTTP requests, session beans, or swing workers, will cause race conditions. If you keep your Hibernate Session in your Http Session, you should consider synchronizing access to your Http Session. Otherwise, a user that clicks reload fast enough may use the same Session in two concurrently running threads.


Have you already tried using a HQL query?

Best regards
Sven

_________________
Please don't forget to give credit, if this posting helped to solve your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 6:19 am 
Newbie

Joined: Fri Jun 24, 2005 5:34 am
Posts: 18
The actual procedure is :

* the user enter the page, see a list of Store,
* he click on a button and then I make an HQL to get a list of Deposist and test if the Deposit I get is use by one of the previous Store list.


You are proposing me to make an HQL each time I want to get a Store information so ?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 6:43 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
It depends on how often your method is called.
Note that a getStoreBy() (with lazy="true") would also lead to another select from the database.

Try to avoid selecting all objects from the database and iterating them afterwards. A single query which tells you whether the Deposit is used or not might be a good solution.

Best regards
Sven

_________________
Please don't forget to give credit, if this posting helped to solve your problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 29, 2005 9:04 am 
Newbie

Joined: Fri Jun 24, 2005 5:34 am
Posts: 18
Ok, i'll try to use more HQL instead of using <map> of Hibernate.

Still I'll have this session problem.

Thx you to you help :)

Hope I'll find an escape


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.