-
1. Re: Saving only modified entities
adamw Dec 8, 2010 1:24 PM (in response to anonimo)Hmm that's very weird ... can you try to set the org.hibernate.envers.revision_on_collection_change property to false?
Also take a look at http://opensource.atlassian.com/projects/hibernate/browse/HHH-5756 - maybe it's something similar?
Adam
-
2. Re: Saving only modified entities
anonimo Dec 8, 2010 2:19 PM (in response to adamw)Thanks for the reply Adam. I think this has nothing to do with collections though. Imagine there is no Desk entity, only an Employee entity. If I save the Employee without modifying any of the attributes (none of these attributes are relationships to other entities but only Strings, Integers, etc) Envers keeps creating new revisions of this entity although nothing has really changed.
-
3. Re: Saving only modified entities
adamw Dec 9, 2010 3:21 AM (in response to anonimo)That's really weird, a new revision should be saved only if there are some modifications.
Could you maybe prepare a failing test case for this?
Thanks,
Adam
-
4. Re: Saving only modified entities
anonimo Dec 9, 2010 5:52 AM (in response to adamw)I attach the use case that is causing the problem. In this use case, I save a new entity, and then in a different session, I save another entity which has exactly the same attributes as the original one. This causes a new revision being created.
However, if when in the second session, right after saving the first entity, I first load it in the persistent context and then modify the values and persist it, a second revision is not created.
In both cases the modified entity has the same values (nothing changes) but one of them creates a new revision and the other doesn't.
Thanks
-
5. Re: Saving only modified entities
adamw Dec 10, 2010 3:55 AM (in response to anonimo)But in the "regular" table, do you get two rows? The entities may differ only in their IDs...
Adam
-
6. Re: Saving only modified entities
anonimo Dec 10, 2010 4:01 AM (in response to adamw)It is exactly the same record, no columns are changed.
-
7. Re: Saving only modified entities
konyshev Dec 13, 2010 8:31 AM (in response to anonimo)Is there any progress on this issue? Got the same problem, revisions being created even there is no data changed.
-
8. Re: Saving only modified entities
anonimo Dec 13, 2010 9:08 AM (in response to konyshev)Hi Sergey. I finally managed to get this working by retrieving the entity I want to modify first. If I then update it while it is in the persistent context, no revisions are created if it hasn't changed. However, If I try to saveOrUpdate a non-persistent entity whose ID already exists, a new revision is created.