Skip to end of metadata
Go to start of metadata

JPBM uses Hibernate for persistence. Hibernate is an ORM, it maps Java object with values in a database. The default is to load all simple property from the database and lazy load the collections. They are loaded only when needed by calling the DB. That means that if the connection to the database is closed, a call to a collection will throw a org.hibernate.LazyInitializationException.

The JbpmService will 'eagerly' load some of the collections of the object returned but not the collections of collections. When the object is returned from a method of the JbpmService, the connection to the DB is closed. So a call such as:

will throw an error. We can't possibly load all collections of collections of objects, otherwise it will load the whole database.

The solution is to load the needed object while still connected to the database, in JbpmService, typically inside a JbpmOperation.

You can have a look at this change set: http://hg.nuxeo.org/nuxeo/nuxeo-features/rev/841cfc4236d8

It removes a call that throws this error with a JbpmOperation that returns the needed task.

A side note, you can use an anonyomous inner class to create a JbpmOperation such as:

But this code will not be portable to a multimachine Nuxeo.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.