Saturday, 15 June 2013

Primary Key of Parent Table not updating in the Child Table in Hibernate Envers -


I have a parent table DataVO , whose list is like this

< Pre @ @OneToMany (fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn (name = "DATA_NUM", tap = false) @AuditJoinTable (name = "EP_DATA_STUS_AUD") from private list & lt; DataStatusVO & gt; DataStatusVOList = new ArrayList & lt; DataStatusVO & gt; ();

DATA_NUM is the primary key of the parent table.

Everything works fine except for fact that DATA_NUM DATA_STUS_AUD is in the table but, fills in the parent and is included in the table DATA_NUM (" EP_DATA_STUS_AUD ")

I get this error, when I put away = false and Update = false to

  @column (name = "DATA_NUM") private string data number; Org.hibernate.MappingException: Repeated columns in mapping for the unit due to: com.envers.DuaStatusVO column: DATA_NUM (insert = "false" should be mapped with the update = "false")  

Any clues on how to work it?

Thanks

"itemprop =" text ">

Hibernate inserts make child's elements first and then update foreign keys In your case Data_status is first recorded and then Hibernate Update Data_num.

To save the envers interceptor only, the savaOrUpdate function is not removed for the update function. In your case when Data_Status is inserted into the table without Data_num, then the enwer interceptor is removed and it copies it and inserts it into the audit table

Then when the hibernation is in the foreign key update Does not, envers are not called. Therefore you will not get any Data_New in Audit Tables.

The included tables accept the primary key from the audit tables to the parent and child tables, as well as to enter the information and incorporate the records. So in your case, Data_num from the Parents table and Data_Status_num

from your child's table as far as the error is concerned, if you want to keep the same parent and child relationship, And to remove insert = false, remove the update = false, then remove the number = incorrect from the @Jen column (name = "parent-child relationship DATA_NUM", drain = false).


No comments:

Post a Comment