My application uses jBPM. In jBPM may be long live processes, in processes may exist some variables.
For example, I have a business process of contract approval. When process started, empty contract created. After contract owner fill common properties, financial people fill theirs field, security theirs, lawyers theirs, and so on. In result, this long process finished and whole contract with all data will be saved into db. And all time before contract was only a process variable with id == null (saved at finish).
But in some other processes variables can be saved multiple times in process, not only at end (saved multiple times).
I need to track changes in process entities and use javers for it.
Process entities are hibernate @Entity
, and by default javers treat them as Entity object. But id of contract appears only at the end of process. And I get ENTITY_INSTANCE_WITH_NULL_ID.
I try to compare them as ValueObject:
Javers javers = JaversBuilder.javers()
.registerValueObject(Contract.class)
.build()
In some situations properties of my entities are hibernate proxies. It is if entity saved multiple times in process. If I use .withObjectAccessHook(new HibernateUnproxyObjectAccessHook())
it tries to get whole db, object references, references of references and so on. So, it is not working solution.
How to get difference of my object in all cases? When Id is null, and when objects are proxies? And not select all data from db :)