Anup Nair [http://community.jboss.org/people/wrecked] created the discussion

"Re: Hibernate LazyInitializationException during swimlane creation"

To view the discussion, visit: http://community.jboss.org/message/566196#566196

--------------------------------------------------------------
Hi Micheal,

I tried using the command as described above.

Here is my code snippet:

final ProcessInstance processInstance = 
executionService.findProcessInstanceById("ServiceCenter.1");
        EnvironmentImpl    environment 
=(EnvironmentImpl)((EnvironmentFactory)processService).openEnvironment();
        try{
                              
                    processService.execute(new Command() {

                        public Object execute(Environment environment)
                                throws Exception {
                            Session session = environment.get(Session.class);
                            Transaction tx  = session.beginTransaction();
                            SwimlaneImpl role = 
((ExecutionImpl)processInstance).createSwimlane("approver");
                            session.update(processInstance);
                            tx.commit();
                            System.out.println("Approver role added:"+role);
                            return role;
                        }
                    });

        }finally{
            environment.close();
        }

The ExecutionImpl class has swimlanes map to which this newly created swimlane 
is inserted. However the map is not lazily getting initialized since the 
session gets closed somehow.


My jbpm.tx.hibernate.cfg.xml has following configuration:

*<?xml version="1.0" encoding="UTF-8"?>*

*<jbpm-configuration>*

*  <process-engine-context>*

*    <command-service name="txRequiredCommandService">
      <skip-interceptor />
      <retry-interceptor />
      <environment-interceptor />
      <standard-transaction-interceptor />
    </command-service>*

*    <command-service name="newTxRequiredCommandService">
      <retry-interceptor />
      <environment-interceptor policy="requiresNew" />
      <standard-transaction-interceptor />
    </command-service>*

*    <hibernate-configuration>
      <cfg resource="jbpm.hibernate.cfg.xml" />     
    </hibernate-configuration>*

*    <hibernate-session-factory />
    
  </process-engine-context>*

*  <transaction-context>
    <transaction />
    <hibernate-session />
  </transaction-context>*

Please tell me is there anything else to be added to this configuration.

Thakns in advance.
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/566196#566196]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to