Hi there. I'm using Hibernate with Spring and JBoss, and am having problems 
with lazy loading. I'm using XDoclet to generate my Hibernate configuration 
files, and have searched on this topic extensively. The best resource so far 
that I have found is here:

http://www.jroller.com/page/kbaum/20040708

an interesting entry is:

http://www-128.ibm.com/developerworks/java/library/j-hibern/

This describes how to implement lazy loading in the business layer. When I 
implement, however, I still get a LazyLoadingException (config files below):

@[EMAIL PROTECTED] 23484 ERROR [AWT-EventQueue-0] 
LazyInitializationException.(25) | Failed to lazily initialize a collection - 
no session or session was closed
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a 
collection - no session or session was closed
        at 
net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:209)
        at 
net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
        at net.sf.hibernate.collection.Bag.iterator(Bag.java:256)


I have also tried using the OpenSessionInViewInterceptor and 
OpenSessionInViewFilter. However, because data objects are accessed using a 
manager class which accesses the DAO class, I didn't have high expectations of 
that method's working.



In our Hibernate application context, we have:

<!-- Transaction manager for a single Hibernate SessionFactory (alternative to 
JTA) -->
    
        
    


along with DAO implementation beans, like so:

<!-- UserDAO: Hibernate implementation -->
    
        
    


We have a "service" application context, wherein is:


      
        
      
    

 
        
            
                
             
        
        
            
                PROPAGATION_REQUIRED
                PROPAGATION_REQUIRED
                PROPAGATION_REQUIRED
                PROPAGATION_REQUIRED
                PROPAGATION_REQUIRED
                PROPAGATION_REQUIRED
                PROPAGATION_REQUIRED
                PROPAGATION_REQUIRED
                PROPAGATION_REQUIRED,readOnly
            
        
        
                
                  
                  //I've tried putting a reference to the hibernateInterceptor 
here. That doesn't help.
                
        
    

    
      
      
        com.adaptiverfid.service.ShipmentManager
      
      
        
          hibernateInterceptor
        
      
    



Any help is appreciated.

Thanks.

Richard


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3914498#3914498

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3914498


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to