views:

19

answers:

1

I have a problem with entity versioning. Here's what I want to archive:

Let's say that I have entity class A (POJO with javax.persistance.* annotations). It's in relations with other entities. Then I need to insert new version of A. All rows should still reffer to old one, but it should be marked as archived and new version should be insterted in database.

Is there any generic mechanism for this or should I create some custom Factory for it?

+1  A: 

Before rolling out your own solution, have a look at Hibernate Envers, it might suit your needs.

See also

Pascal Thivent