-
1. Re: Changing the id of a processDefinition or of a instance?
rodosa Dec 10, 2007 2:49 PM (in response to rodosa)Is normal that when you creates:
ProcessDefinition processDef = ProcessDefinition.parseXmlResource("SeleccionDePersonal/processdefinition.xml"); assertNotNull("La definición del proceso no debe ser nula", processDef); //Crea una instancia del proceso ProcessInstance instancia = new ProcessInstance(processDef); assertEquals("La instancia del proceso se encuentra en el estado inicial", instancia.getRootToken().getNode().getName(), "Establecer criterios del puesto de trabajo");
The id's of the processDefinition & the instance were 0???? -
2. Re: Changing the id of a processDefinition or of a instance?
dleerob Dec 11, 2007 2:49 AM (in response to rodosa)You shouldn't be changing the ID of a ProcessDefinition or ProcessInstance. They are auto generated when saving to the database, as with most id fields. They start at zero, and increment by one for each new table row.
So yes, the first ones should have an ID of zero, and then the next one will have an ID of 2, and then 3, and then 4, etc etc etc......It's just a unique identifier. Let it be :) -
3. Re: Changing the id of a processDefinition or of a instance?
dleerob Dec 11, 2007 2:51 AM (in response to rodosa)and then the next one will have an ID of 2, and then 3, and then 4, etc etc etc
I forgot the '1' :) -
4. Re: Changing the id of a processDefinition or of a instance?
rodosa Dec 11, 2007 5:30 AM (in response to rodosa)Thank you dleerob! I know that the ID is autoincrement, but I don't want that the first ID ProcessDefinition was 0, becasuse hibernate thrwos me the following exception and I think that the problem is in de ID=0.
11:29:23,192 [main] ERROR DbPersistenceService : hibernate commit failed org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.def.Node at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219) at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397) at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:242) at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:576) at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3121) at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:472) at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:197) at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:120) at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:256) at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:214) at org.jbpm.svc.Services.close(Services.java:225) at org.jbpm.JbpmContext.close(JbpmContext.java:139) at com.Ejemplo1.Test2.testEjemplo1Process(Test2.java:75) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
-
5. Re: Changing the id of a processDefinition or of a instance?
aguizar Dec 19, 2007 6:16 PM (in response to rodosa)Nope, the problem is that you forgot to deploy the process definition before creating a process instance:
jbpmContext.deployProcessDefinition(pd). See the examples in the user guide. -
6. Re: Changing the id of a processDefinition or of a instance?
rodosa Dec 20, 2007 3:50 AM (in response to rodosa)Thank you very much alex.guizar@jboss.com . I thought that it was a problem of configuration because when the Jboss server starts, there is a problem:
2007-12-20 09:33:11,375 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not execute query [select job0_.ID_ as ID1_26_, job0_.VERSION_ as VERSION3_26_, job0_.DUEDATE_ as DUEDATE4_26_, job0_.PROCESSINSTANCE_ as PROCESSI5_26_, job0_.TOKEN_ as TOKEN6_26_, job0_.TASKINSTANCE_ as TASKINST7_26_, job0_.ISSUSPENDED_ as ISSUSPEN8_26_, job0_.ISEXCLUSIVE_ as ISEXCLUS9_26_, job0_.LOCKOWNER_ as LOCKOWNER10_26_, job0_.LOCKTIME_ as LOCKTIME11_26_, job0_.EXCEPTION_ as EXCEPTION12_26_, job0_.RETRIES_ as RETRIES13_26_, job0_.NAME_ as NAME14_26_, job0_.REPEAT_ as REPEAT15_26_, job0_.TRANSITIONNAME_ as TRANSIT16_26_, job0_.ACTION_ as ACTION17_26_, job0_.GRAPHELEMENTTYPE_ as GRAPHEL18_26_, job0_.GRAPHELEMENT_ as GRAPHEL19_26_, job0_.NODE_ as NODE20_26_, job0_.CLASS_ as CLASS2_26_ from JBPM_JOB job0_ where (job0_.LOCKOWNER_ is null or job0_.LOCKOWNER_=?) and job0_.RETRIES_>0 and job0_.DUEDATE_<=? and job0_.ISSUSPENDED_<>1 order by job0_.DUEDATE_ asc] java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 job0_.ID_ as ID1_26_, job0_.VERSION_ as VERSION3_26_, job0_.DUEDATE_ as DUEDAT' at line 1 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1695) at com.mysql.jdbc.Connection.execSQL(Connection.java:3026) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1137) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1231) at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:90) at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:756) at org.jbpm.db.JobSession.getFirstAcquirableJob(JobSession.java:40) at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:114) at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:58) 2007-12-20 09:33:11,375 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 1064, SQLState: 42000 2007-12-20 09:33:11,375 ERROR [org.hibernate.util.JDBCExceptionReporter] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 job0_.ID_ as ID1_26_, job0_.VERSION_ as VERSION3_26_, job0_.DUEDATE_ as DUEDAT' at line 1 2007-12-20 09:33:11,375 ERROR [org.jbpm.db.JobSession] org.hibernate.exception.SQLGrammarException: could not execute query 2007-12-20 09:33:11,375 DEBUG [org.jbpm.JbpmContext] closing jbpmContext org.jbpm.JbpmContext@13bcbc8 2007-12-20 09:33:11,375 DEBUG [org.jbpm.svc.Services] closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@1a17727 2007-12-20 09:33:11,375 DEBUG [org.jbpm.persistence.db.DbPersistenceService] committing hibernate transaction org.hibernate.transaction.JDBCTransaction@1712a80 2007-12-20 09:33:11,375 DEBUG [org.hibernate.transaction.JDBCTransaction] commit 2007-12-20 09:33:11,375 DEBUG [org.hibernate.transaction.JDBCTransaction] re-enabling autocommit 2007-12-20 09:33:11,375 DEBUG [org.hibernate.transaction.JDBCTransaction] committed JDBC Connection 2007-12-20 09:33:11,375 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection 2007-12-20 09:33:11,375 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)] 2007-12-20 09:33:11,375 DEBUG [org.jbpm.persistence.db.DbPersistenceService] closing hibernate session 2007-12-20 09:33:11,375 DEBUG [org.jbpm.svc.Services] closing service 'tx': org.jbpm.tx.TxService@195bbec 2007-12-20 09:33:11,375 ERROR [org.jbpm.job.executor.JobExecutorThread] exception in job executor thread. waiting 640000 milliseconds org.jbpm.JbpmException: couldn't get acquirable jobs at org.jbpm.db.JobSession.getFirstAcquirableJob(JobSession.java:44) at org.jbpm.job.executor.JobExecutorThread.acquireJobs(JobExecutorThread.java:114) at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:58) Caused by: org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2148) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:392) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:333) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:756) at org.jbpm.db.JobSession.getFirstAcquirableJob(JobSession.java:40) ... 2 more Caused by: java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 job0_.ID_ as ID1_26_, job0_.VERSION_ as VERSION3_26_, job0_.DUEDATE_ as DUEDAT' at line 1 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2975) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1600) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1695) at com.mysql.jdbc.Connection.execSQL(Connection.java:3026) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1137) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1231) at org.jboss.resource.adapter.jdbc.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:90) at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) ... 11 more
Any idea of that? I want Jboss jbpm works with MySQL and I made changes following http://wiki.jboss.org/wiki/Wiki.jsp?page=SetUpMysqlAsDefaultDS and I changed the hibernate configurations files to get that, but ... when the server starts this uses HSQL dialect, no MySQLDialect. :(
And ... I think that because of this problem ... I can't enter into Jboss jBPM web console (http://localhost:8080/jbpm-console) with the default users.
Thanks in advance
Regrads, -
7. Re: Changing the id of a processDefinition or of a instance?
soumya_in Jan 9, 2008 5:02 AM (in response to rodosa)Redeploy your jbpm-console.war/jbpm.war file by changing ../WEB-INF/classes/hibernate.cfg.xml.I think that will be helpful......
-
8. Re: Changing the id of a processDefinition or of a instance?
soumya_in Jan 9, 2008 5:02 AM (in response to rodosa)Redeploy your jbpm-console.war/jbpm.war file by changing ../WEB-INF/classes/hibernate.cfg.xml.I think that will be helpful......