[jboss-user] [JBoss jBPM] - IdentitySession commit exception

JimKnopf do-not-reply at jboss.com
Thu Jan 18 08:44:59 EST 2007


New Day, new Problem.

Hi again.

I want du add Users to my JBPM-Engine ...
at the beginning it works fine but now, i have a problem i don't realy understand.

At first the code that works fine:

  |                     IdentitySession identitySession = new IdentitySession( this.getCurrentSession() );
  |                     for (int i = 0; i < entities.length; i++) {                        
  |                         identitySession.saveEntity( entities );
  |                     }
  |                     this.newTransaction();
  | 

And now the code witch produce a Exception:

  | 			for (int i = 0; i < entities.length; i++) {
  |                                 System.err.println("-----------> ... "+ this.getCurrentSession());
  |                                 IdentitySession identitySession = new IdentitySession( this.getCurrentSession() );	
  | 				identitySession.saveEntity( entities );
  |                                 this.newTransaction();
  | 			}
  | 

The Exception:

  | Checking 28 named HQL queries
  | Checking 0 named SQL queries
  | -----------> ... SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
  | -----------> ... SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[]])
  | org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
  |         at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:172)
  |         at org.jbpm.svc.Services.close(Services.java:211)
  |         at org.jbpm.JbpmContext.close(JbpmContext.java:139)
  |         at medisite.arcaVia.service.ArcaViaController.closeJbpmContext(ArcaViaController.java:559)
  |         at medisite.arcaVia.service.ArcaViaController.commitAndCloseSession(ArcaViaController.java:377)
  |         at medisite.arcaVia.service.ArcaViaController.newTransaction(ArcaViaController.java:387)
  | 

The other methods i called in this block:

  |     private Session getCurrentSession(){
  |         return this.getCurrentJbpmContext().getSession();
  |     }
  | 
  |     private synchronized void newTransaction() {
  |         try {
  |             commitAndCloseSession();
  |             beginSessionTransaction();
  |         } catch (Throwable t) {
  |             throw new RuntimeException(
  |                     "couldn't commit and start new transaction", t);
  |         }
  |     }
  | 
  |     public synchronized void commitAndCloseSession() {        
  |         this.closeJbpmContext();
  |     }
  | 
  |     private void closeJbpmContext() {
  |         if( this.getCurrentJbpmContext() != null ){
  |             this.getCurrentJbpmContext().close();
  |         }
  |     }
  | 
  |     public JbpmContext getCurrentJbpmContext(){
  |         return this.getJbpmConfiguration().getCurrentJbpmContext();
  |     }
  | 
  |     private JbpmConfiguration getJbpmConfiguration() {
  |         return jbpmConfiguration;
  |     }
  | 
  |     public synchronized void beginSessionTransaction() {
  |         if( this.getCurrentJbpmContext() == null ){
  |             createJbpmContext();
  |         }
  |     }
  | 
  |     private void createJbpmContext() {
  |         getJbpmConfiguration().createJbpmContext();
  |     }
  | 
  | private static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
  | 

The reason i wan't to make a commit after every User is,
that i want to have a method to add Users like this:


  |     private void addEntity( Entity e ){
  |         if( e == null )
  |             return;
  |         
  |         if( this.getCurrentJbpmContext() == null )
  |             this.beginSessionTransaction();
  | 
  |         IdentitySession identitySession = this.getIdentitySession();        
  |         identitySession.saveEntity( e );
  | 
  |         this.newTransaction();
  |     }
  | 


Any body an idea why i get the exception?

Thank for ur help.


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

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



More information about the jboss-user mailing list