JBoss Community

Re: Hibernate tool - HQL query fails with LazyInitializationException

created by Stephanie Smith in JBoss Tools - View the full discussion

The problem is that my object does have a field that uses lazy instantiation (not eagerly fetched).

It appears the hibernate tool calls the toString() method on my object, which tries to invoke this field and thus the error.

To work around i just changed my toString for now so it doesn't access this field.

 

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.sas.workflow.engine.mediation.hibernate.HibProcess.subprocesses, no session or session was closed

        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:383)

        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:375)

        at org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:122)

        at org.hibernate.collection.PersistentSet.size(PersistentSet.java:162)

        at com.sas.workflow.engine.mediation.hibernate.HibProcess.toString(HibProcess.java:634)

        at org.hibernate.eclipse.console.views.QueryPageViewer$LabelProviderImpl.getColumnText(QueryPageViewer.java:86)

 

 

 



Reply to this message by going to Community

Start a new discussion in JBoss Tools at Community