JBoss Community

Re: Storing a long String (>255 Characters) in a Process Variable is not Possible(?)

created by Silvio Meier in jBPM - View the full discussion

To illustrate the problem, I attached a simple dummy test. After deploying  it (execute the deploy class) and istantiating (using the class CreateInstance) a process with a test variable (testvar) that should be stored in a long text field  is created. the acutal code looks as follows:

 

ProcessEngine processEngine = new Configuration().setResource("jbpm.cfg.xml").buildProcessEngine();

 

RepositoryService repositoryService = processEngine.getRepositoryService();

ExecutionService executionService = processEngine.getExecutionService();

 

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

variables.put("testvar", "This is a test variable for a text".toCharArray());       

executionService.startProcessInstanceByKey("test", variables);   

 

After  creating the instance with the long text variable testvar, the following exception occurs:

 

Caused by: java.lang.ClassCastException: [C cannot be cast to java.lang.String

    at org.hibernate.type.TextType.toString(TextType.java:94)

    at org.hibernate.type.NullableType.nullSafeToString(NullableType.java:117)

    at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:158)

    at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:131)

    at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2015)

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

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

    at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79)

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

    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)

    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)

    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)

    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)

    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)

    at org.jbpm.pvm.internal.tx.HibernateSessionResource.prepare(HibernateSessionResource.java:56)

    at org.jbpm.pvm.internal.tx.StandardTransaction.commit(StandardTransaction.java:107)

    at org.jbpm.pvm.internal.tx.StandardTransaction.complete(StandardTransaction.java:64)

    at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:57)

    at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)

    at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)

    at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:56)

    at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)

    at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.createVariables(ExecutionServiceImpl.java:174)

 

I didn't find an open issue in the ticket tracker. Are there any ideas?

Reply to this message by going to Community

Start a new discussion in jBPM at Community