[jboss-user] [JBoss jBPM] - saving own objects with Hibernate in jbpm

jbaton do-not-reply at jboss.com
Fri Sep 8 06:07:59 EDT 2006


Hi all,

I have custom objects that I have added to the jbpm schema. 
Those objects are hibernatable. My app is multithreaded.

What is the prefered way to save the custom objects ?

When I get the hibernate session from a newly created jbpmcontext, I get an exception like this 
org.jbpm.JbpmException: closed JbpmContext in different order then they were created... check your t
  | ry-finally's around JbpmContexts blocks

Using something like this in my main class , 

  | public static synchronized JbpmContext getPersistenceContext() {
  | 		if(JbpmContext.getCurrentJbpmContext()!=null)
  | 			return JbpmContext.getCurrentJbpmContext();
  | 		else 
  | 			return instanceConfigurationJbpm.createJbpmContext() ;
  | 	}
  |  
, I get an NPE on a Criteria.list() call based on a Session obtained via getPersistenceContexte().getSession

java.lang.NullPointerException
  | 	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:442)
  | 	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:368)
  | 	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
  | 	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
  | 	at org.hibernate.loader.Loader.doQuery(Loader.java:661)
  | 	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
  | 	at org.hibernate.loader.Loader.doList(Loader.java:2150)
  | 	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
  | 	at org.hibernate.loader.Loader.list(Loader.java:2024)
  | 	at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
  | 	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1492)
  | 	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:298)
  | ......
  | 

What is the best practise to save one's own objects ?


Thanks


Jerome



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

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



More information about the jboss-user mailing list