Thanks Ronald and Pedro,
Your help is much appreciated.
I am trying the code you have posted with default configuration using
hibernate3.jar. And I am using the default configuration for HSQL database
only. If I connect to the HSQL manager I could see the process definition
"simple":
select * from jbpm_processdefinition;
However I get the following error "table not found" sql exception when I
execute the code: This suggests that the jbpm_processdefinition table is not
in the query. Am I missing something. If it is a trivial issue, please post any
pointers that help me progress.
(1)
Exception in thread "main" org.jbpm.JbpmException: couldn't find process
definition 'simple'
at
org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:155)
at instanciacao.inst(instanciacao.java:78)
at instanciacao.main(instanciacao.java:97)
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2153)
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:369)
at
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:300)
at
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:146)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1093)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at
org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:745)
at
org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:138)
... 2 more
Caused by: java.sql.SQLException: Table not found in statement [select top ?
processdef0_.ID_ as ID1_4_, processdef0_.NAME_ as NAME2_4_,
processdef0_.VERSION_ as VERSION3_4_, processdef0_.ISTERMINATIONIMPLICIT_ as
ISTERMIN4_4_, processdef0_.STARTSTATE_ as STARTSTATE5_4_ from
JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by
processdef0_.VERSION_ desc]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.(Unknown Source)
Your code to make sure I have not missed any thing:
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import junit.framework.TestCase;
import org.jbpm.db.*;
import org.jbpm.graph.def.*;
import org.jbpm.graph.exe.*;
import org.jbpm.*;
import org.jbpm.db.JbpmSession;
import org.jbpm.db.JbpmSessionFactory;
import org.jbpm.graph.def.DelegationException;
import org.jbpm.graph.exe.Token;
public class instanciacao{
static JbpmConfiguration jbpmConfiguration = null;
static {
jbpmConfiguration = JbpmConfiguration.parseXmlString(
"<jbpm-configuration>" +
" <jbpm-context>" +
" <service name='persistence' " +
" factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
" <service name='message' " +
" factory='org.jbpm.msg.db.DbMessageServiceFactory' />" +
" <service name='scheduler' " +
" factory='org.jbpm.scheduler.db.DbSchedulerServiceFactory' />" +
" <service name='logging' " +
" factory='org.jbpm.logging.db.DbLoggingServiceFactory' />" +
" <service name='authentication' " +
"
factory='org.jbpm.security.authentication.DefaultAuthenticationServiceFactory'
/>" +
" <service name='persistence' " +
" factory='org.jbpm.persistence.db.DbPersistenceServiceFactory' />" +
" </jbpm-context>" +
" <string name='resource.hibernate.cfg.xml' " +
" value='hibernate.cfg.xml' />" +
" <string name='resource.business.calendar' " +
" value='org/jbpm/calendar/jbpm.business.calendar.properties' />" +
" <string name='resource.default.modules' " +
" value='org/jbpm/graph/def/jbpm.default.modules.properties' />" +
" <string name='resource.converter' " +
" value='org/jbpm/db/hibernate/jbpm.converter.properties' />" +
" <string name='resource.action.types' " +
" value='org/jbpm/graph/action/action.types.xml' />" +
" <string name='resource.node.types' " +
" value='org/jbpm/graph/node/node.types.xml' />" +
" <string name='resource.varmapping' " +
" value='org/jbpm/context/exe/jbpm.varmapping.xml' />" +
"</jbpm-configuration>"
);
}
public void inst(int i)
{
JbpmContext jbpmContext =
this.jbpmConfiguration.getInstance().createJbpmContext(); //how u tell me to
do=)
try {
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition processDefinition =
graphSession.findLatestProcessDefinition("simple");
ProcessInstance processInstance =
new ProcessInstance(processDefinition);
jbpmContext.save(processInstance);
System.out.println("Ended");
} finally {
jbpmContext.close();
}
}
public static void main(String[] args)
{
instanciacao i = new instanciacao();
i.inst(1);
}
}
thanks
Regards
-Shiv
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950871#3950871
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950871
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user