[rules-users] Issue serializing KnowledgePackage with hibernate

gqmulligan gqmulligan at gmail.com
Wed Sep 19 11:24:01 EDT 2012


I am using drools 5.3.1.

I have a case where I need to recompile and update many knowledge packages
within a single hibernate session.  The problem I am facing is that with
each subsequent select I do to get the next knowledge package, an extra
update is done for every knowledge package updated so far.

I dug into the code and think I found the issue. Hibernate returns a new
knowledge package that it puts in its cache after updating.  When hibernate
later does a check to see if this object has changed since it was last saved
it always thinks there was a change for the following reasons:
1.) The knowledge package does not reference the same object.
2.) The internal package is not the same reference (it does an identity
check in the equals method of the KnowledgePackageImpl)
3.) The serialized bytes are compared and are for some reason different even
though no changes were made to the knowledge package.

Somehow it seems I need to get hibernate to know that the knowledge package
did not change since the last update.  Is there an easy way to do this? It
seems like number 2 or 3 from above should work but fail for the reasons
given.

Otherwise the only workaround I can think of would be too load all knowledge
packages that will need to be updated first, recompile them all, and then
update them all at once.  This is not the simplest thing to do with the way
things currently work so it would be great if hibernate could handle this
for me.

Thanks.



--
View this message in context: http://drools.46999.n3.nabble.com/Issue-serializing-KnowledgePackage-with-hibernate-tp4019845.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list