0 Replies Latest reply on Jul 15, 2013 11:02 AM by abadr

    Postgresql and JBPM5.4 issue

    abadr Newbie

      Hi,

       

      I want to include workflow processes in my project, which is currently using postgresql 8.4. I added a workflow process and want it to be persistent. I am using sample database for this purpose. I configured the persistence.xml file with the required data sources. However, some tables were not generated, so I had to modify the sql scripts for those tables (to be compatible with postgresql). I will include the sql script for these tables below. When I added these tables manually to database and tried to run the process again, I got the following exceptions (I guess this might be due to the Identity issue with postgresql but I am not sure how to resolve this problem):

      0    15/07 16:57:16,156[main] ERROR hibernate.util.JDBCExceptionReporter.logExceptions  - ERROR: null value in column "id" violates not-null constraint

      6    15/07 16:57:16,162[main] ERROR drools.persistence.SingleSessionCommandService.rollbackTransaction  - Could not commit session

      javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not insert:

           at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:614)

           at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:226)

           at org.drools.persistence.jpa.JpaPersistenceContext.persist(JpaPersistenceContext.java:24)

           at org.drools.persistence.SingleSessionCommandService.(SingleSessionCommandService.java:153)

           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

           at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

           at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:128)

           at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:66)

           at org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:122)

           at org.jbpm.test.JBPMHelper.loadStatefulKnowledgeSession(JBPMHelper.java:159)

           at org.jbpm.test.JBPMHelper.newStatefulKnowledgeSession(JBPMHelper.java:136)

           at com.sample.UploadDocumentWorkflowProcessMain.main(UploadDocumentWorkflowProcessMain.java:46)

      Caused by: org.hibernate.exception.ConstraintViolationException: could not insert:

           at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)

           at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)

           at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:64)

           at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2176)

           at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2656)

           at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)

           at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)

           at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:321)

           at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)

           at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)

           at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)

           at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:154)

           at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:110)

           at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:61)

           at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:646)

           at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:620)

           at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:624)

           at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:220)

           ... 12 more

      Caused by: org.postgresql.util.PSQLException: ERROR: null value in column "id" violates not-null constraint

           at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2157)

           at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1886)

           at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

           at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:555)

           at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)

           at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)

           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

           at java.lang.reflect.Method.invoke(Method.java:606)

           at bitronix.tm.resource.jdbc.BaseProxyHandlerClass.invoke(BaseProxyHandlerClass.java:63)

           at com.sun.proxy.$Proxy32.executeUpdate(Unknown Source)

           at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:94)

           at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:57)

           ... 27 more

       

      My persistance.xml file is as follows: