My JBPM 7.44/Redhat PAM 7.10 case application has a process which nests stages and our stages nest tasks that map to JBPM tasks; the application loops through stages that loop through tasks that refer to JBPM tasks.
I moved some of the processing from the main process to an embedded subprocess. When the application goes from the first to the second stage I now get
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be truncated.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1632)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:602)
as the end of the stack trace. This occurs in the script
System.out.println("Task setup for stage enter");
com.me.MyStage stage = (com.me.MyStage ) kcontext.getVariable("caseFile_Stage");
System.out.println("Starting stage {name=" stage.getName() "}");
// Tasks
java.util.List<com.me.MyTask> tasks = stage.getTasks();
System.out.println("1 - # tasks=" tasks.size());
kcontext.setVariable("Tasks", tasks); // error occurs here
The Hibernate tags on the tasks field are:
@javax.persistence.OneToMany(cascade = {javax.persistence.CascadeType.ALL})
@javax.persistence.JoinTable(name = "STAGE_TASKS_JOIN")
@com.fasterxml.jackson.annotation.JsonProperty("tasks") @org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.FALSE)
private java.util.List<com.me.MyTask> tasks;
Perhaps I misunderstand the error, but it seems like the data in the records could not be truncated by the assignment - what is really going on and how do I need to change the tags to avoid the the exception? I think the issue is that it is trying to persist the data from the tasks in stage 1 when I make this assignment to use the tasks in stage 2 - but assigning to the process variable using kcontext also seems it should not force any persistence except perhaps to JBPM's VariableInstanceLog (which I see warnings about in other environments, not errors). VariableInstanceLog is defined as a varchar(255) for the field "oldValue" and as a "text" for the value field.
CodePudding user response:
Part of the solution, which I suspected, is that inserting into VariableInstanceLog is throwing the exception. If this were a less sensitive system I could drop/add the table. It may be that at one point I used a JBoss property to refer to the tables as varchar(4000) when they are in reality only varchar(255).
RPC:Completed exec sp_executesql N'insert into VariableInstanceLog (log_date, externalId, oldValue, processId, processInstanceId, value, variableId, variableInstanceId) values (@P0, @P1, @P2, @P3, @P4, @P5, @P6, @P7) select SCOPE_IDENTITY() AS GENERATED_KEYS',N'@P0 datetime2,@P1 nvarchar(4000),@P2 nvarchar(4000),@P3 nvarchar(4000),@P4 bigint,@P5 nvarchar(4000),@P6 nvarchar(4000),@P7 nvarchar(4000)','2021-10-08 15:57:47.2710000',N'ams-pam_2.0.3-m1',N'[MyTask(id=172488, owner=0BD0194B-0000-4AED-9161-43D030686D7E, name=Stage1Task1P, dateCompleted=null, dateCreated=2021-10-08T14:55:55.625, status=STARTED, MyTask(id=172489, owner=0BD0194B-0000-4AED-9161-43D030686D7E, name=Stage1Task1P, dateCompleted=null, dateCreated=2021-10-08T14:56:23.813, status=STARTED]',N'AMS_Workflow',7184,N'[MyTask(id=172490, owner=0BD0194B-0000-4AED-9161-43D030686D7E, name=Stage2Task1P, dateCompleted=null, dateCreated=null, status=null]',N'Tasks',N'Tasks' 0 99 12 ..
CodePudding user response:
You can increase the VariableInstanceLog length setting up a different value to this system property
org.jbpm.var.log.length
modifying accordingly that column in your database.