I found the problem (I believe....) but I don't know how to fix it.
I believe it is a problem related to hibernate.
The JBPM_VARIABLEINSTANCE table contains a column DATEVALUE_ of type "timestamp" and the hibernate mapping use that column for every java.util.Date (or extends) classes.
So java.sql.Date will be a java.sql.Timestamp when read it back.
So, I believe it is necessary to change this behaviours.
I believe there are only 2 way:
1) add 2 new columns to JBPM_VARIABLEINSTANCE in order to add a Date and a Time column.
add mapping for this 2 new column
2) change the org.jbpm.context.exe.variableinstance.DateInstance (...create a new class estending from it) that analize data and return back a java.sql.Date or a java.sql.Time or a java.sql.Timestamp according column value.
but.. I don't know hibernate .. so I believe this is not the right way and/or how to do it
Can someone help me ?
why don't you just use a java.util.Date?
Much easier, future proof etc...
it is very simple.
My ERP application use java.sql.Date, java.sql.Timestamp and java.sql.Time field/columns.
I need to set ERP column as variable in the process instance and read it back and obtain the same object.
the same object? or the same value? A small wrapper to convert it for you is much easier I think then making changes to the jBPM core. Or you can even try to write a converter for jBPM. (see the testcases in the source how this can be done).
Thanks for all kukeltje.
I decide to convert myself from java.sql.Timestamp returned by jBPM to my right java type.
it is only some additional operations (of course less code.. better performnace... :) )