[jboss-user] [jBPM] - Cannot insert null into table error while starting a process

jess singh do-not-reply at jboss.com
Thu Jul 5 10:57:33 EDT 2012


jess singh [https://community.jboss.org/people/singhjess] created the discussion

"Cannot insert null  into table error while starting a process"

To view the discussion, visit: https://community.jboss.org/message/746402#746402

--------------------------------------------------------------
Hi all , we are using JBPM 5.3 on Jboss 7.1 with Hibernate 4 and using JBoss's transaciton manager  and seam managed persistence context, when I try to start  a  process I get the following error 


  
08:53:14,876 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost-127.0.0.1-8080-1) SQL Error: 23502, SQLState: 23502
08:53:14,878 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost-127.0.0.1-8080-1) NULL not allowed for column "INSTANCEID"; SQL statement:
insert into ProcessInstanceInfo (InstanceId, id, lastModificationDate, lastReadDate, processId, processInstanceByteArray, startDate, state, OPTLOCK) values (null, ?, ?, ?, ?, ?, ?, ?, ?) [23502-161]
08:53:14,888 ERROR [org.drools.persistence.SingleSessionCommandService] (http-localhost-127.0.0.1-8080-1) Could not commit session: 
: org.hibernate.exception.ConstraintViolationException





* * 


*public* *void*startProcess() {
*try**{*
*KnowledgeBase kbase = +readKnowledgeBase+();*
*TransactionManager manager = (TransactionManager)* *new InitialContext().lookup("java:jboss/TransactionManager"**);*
*// create the entity manager factory and register it in the environment*

*EntityManagerFactory emf = Persistence.+createEntityManagerFactory+(* *"main"**);*
*Environment env = KnowledgeBaseFactory.+newEnvironment+();*
*env.set( EnvironmentName.*++*ENTITY_MANAGER_FACTORY*++*, emf );*
*//env.set( EnvironmentName.TRANSACTION, getUserTransaction());*

*env.set(EnvironmentName.*++*GLOBALS*++*, new* 
*MapGlobalResolver());*

*env.set(EnvironmentName.*++*APP_SCOPED_ENTITY_MANAGER*++*, entityManager**);*
*env.set(EnvironmentName.*++*TRANSACTION_MANAGER*++*, manager);*



*Map<String, Object> params =* *new**HashMap<String, Object>();*

*// org.drools.persistence.info.WorkItemInfo wi;*

*//org.jbpm.task.Comment comment;*


*params.put(**"name", "Arthur"**);*
*params.put(**"money"**, 1800);*


*// create a new knowledge session that uses JPA to store the runtime state*

*StatefulKnowledgeSession ksession = JPAKnowledgeService.+newStatefulKnowledgeSession+( kbase,* *null**, env );*
*int**sessionId = ksession.getId();*

*System.*++*out*++*.println(sessionId);*
*// invoke methods on your method here*

*ksession.startProcess(* *"process_1"**, params);*


*ksession.dispose();*
*}* *catch**( Throwable t ) {*
*t.printStackTrace();*
*}*



Here is my persistence.xml 



  
<


persistence xmlns=
++" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence"+
+
--------------------------------------------------------------

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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120705/abdab77a/attachment-0001.html 


More information about the jboss-user mailing list