No, it is a bug. The BPEL_FROM table is supposed to be immutable once the process gets saved to the database. However the element type is mutable, and Hibernate probably does not know enough to realize the element did not change. Please do file the jira issue.
Thanks for your reply.
When we tried setting mutable="false" on the hbm.xml file itself, in some cases, it resulted in exception
INFO | jvm 1 | 2009/01/29 22:21:08 | java.lang.NullPointerException INFO | jvm 1 | 2009/01/29 22:21:08 | at org.jbpm.bpel.graph.basic.assign.FromVariable.extract(FromVariable.java:44) INFO | jvm 1 | 2009/01/29 22:21:08 | at sun.reflect.GeneratedMethodAccessor310.invoke(Unknown Source) INFO | jvm 1 | 2009/01/29 22:21:08 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
This was running on JBoss 4.0.5GA with Hibernate 3.2.0GA jars. On other server where we were running newer version of Hibernate, it seemed to work ok.
There is one more thing we tried is creating new ElementType, just for ELEMENT_ column of this table and changed its equals method to always return true. When hibernate calls 'IsDirty' on various objects, this type always says not dirty. After this it didn't run that query anymore. Changing the isMutable method of this new class to return false did not have exact same effect, though it reduced the number of queries.
Can you please suggest what is the right approach to fix this locally for us? The flag on hbm.xml file seemed to be the right one until we got that exception.
I will be filing JIRA issues shortly.