|@GeneratedValue strategy for History Policy [message #895156]
||Wed, 11 July 2012 16:15
| Nick Padilla
Registered: August 2011
Location: New Mexico
I have been trying to get Auditing/History going for my application. I am not sure what else to do here. I have created my entities using a @MappedSuperclass that contains the @Id and @GeneratedValue. So far so good. Without the @Customizer everything works as expected. When you update the object it keeps the id already assigned. No errors or problems. However when I enable the HistoryPolicy, i just extended the base class so that eclipselink can create the table, it throws Primary Key errors since it is trying to do an insert of an updated row with an already used ID. I have tried to use SEQUENCE and AUTO as the strategies and started out with IDENTITY, however they all throw the same error. I am using EclipseLink 2.4 snapshot and JDK7. I don't think the @MappedSuperclass has anything to do with the problem, I believe it to be a bug in the EclipseLink HistoryPolicy implementation. In reality I shouldn't have to change the entity to ensure the @Id is setup correctly, however I did that as well but same problem. JPA2 requires a PRIMARY key for all Entities so not sure how to implement this so that it works. What I want to do is to have Two Entities - one the 'live' entity and another the 'history' entity. I will only use the history entities as read only so show the audit/history trail of the objects.
Any questions or ideas would be greatly appreciated.
Powered by FUDForum
. Page generated in 0.02017 seconds