[jboss-user] [JBoss Seam] - failed to lazily initialize a collection of role exception

samdoyle do-not-reply at jboss.com
Tue Sep 4 23:15:26 EDT 2007


So I want to use Hibernate 3.2 for my EM in a JEE5 environment. However, I have an entity that has and requires TWO mappings of the following:


  | @OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER, mappedBy = "owningILDA")
  | 

The FetchType is EAGER. This is not against he spec. and should be allowed by Hibernate but it is not. So if I change one to be LAZY I get this exception:

  | Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.covaluate.infotek.ilda.ejb.entity.ILDAEntityBean.ilda15MinUpdates, no session or session was closed
  |         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
  |         at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
  |         at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
  |         at org.hibernate.collection.AbstractPersistentCollection.write(AbstractPersistentCollection.java:183)
  |         at org.hibernate.collection.PersistentBag.add(PersistentBag.java:274)
  | 

Is there another way around this besides switching back to TopLink Essentials which doesn't result in this problem?

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

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



More information about the jboss-user mailing list