Hi Aron,

     I'm using MySQL 4.1. Maybe you shouldn't re-use JbpmSession. Try opening a 
new session everytime and close it immediately, throw it away. Use 
JbmpSessionFactory.getInstance().openJbpmSession instead. anonymous wrote : 
This is a web-app and normally, we have used the session-per-request pattern, 
so there is one session created for each request and that's retrieved with 
JbpmSession.getCurrentJbpmSession(); 

I think a JbpmSession represents one database connection. If you're worried 
about performance issues, don't be, IF you are using database connection 
pooling. Upon closing the jbpm session it does not actually close the 
connection but returns it to the pool. If you implement your own pooling, I 
suggest you instead let the container manage it, it is already provided and it 
takes away your headaches. If you're uncomfortable with hibernate like me, I 
don't let hibernate manage my pooling. But its quite easy to configure. In the 
hbm.hibernate.properties file you could add this entry: 
hibernate.connection.datasource=[your datasource name]  
and comment out connection settings in the jbpm.hibernate.cfg.xml. 

Here was my problem. I am using JBoss. In a CMT (container managed 
transaction), it does not allow you to do a beginTransaction and 
commitTransaction. I only used saveProcessInstance. It inserts some data to the 
database but was incomplete. I was pretty sure that the problem was due to 
committing the data. I was able to solve this by doing the ff. statements (the 
flush and close statements was the key)
   

  |   JbpmSession s = JbpmSessionFactory.getInstance().openJbpmSession();
  |   try {
  |        s.getGraphSession().saveProcessInstance( p );
  |   }
  |   catch( Exception e) {
  |        //error handling here       
  |   } 
  |   finally {
  |       try { s.getSession().flush(); } catch( Exception igmore ) {;}
  |       try { s.close(); } catch (Exception ignore) {;}
  |   }
  | 

Anyway, this might not be the solution to your problem but it might give you an 
idea. 

Regards,

Elmo

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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to