I have a table say "Employee" and that table entity is annotated with @Audited. So an "Employee_Aud" is created. "Employee_Aud" is having foreign key constraint to "Employee", because of this I am not able to delete any records from "Employee" table. I guess this is fixed in 5.2.11, but I am using 5.2.12 still Audit tables are created with FK constraint with Parent table. Please advice.
, any update on this for me?
, are you able to at least show me the mappings generically? You mentioned the entity has a self-referencing attribute, how did you map it with the @Audited and @NotAudited annotations?
I'd really like to understand your problem but there are a variety of reasons as to why you have this foreign-key being created and without any information to work on its going to be difficult to find a resolution for you. I'm going to leave this open for another 30 days at which point if I don't hear anything I'm going to proceed with closing this issue.
Hi - I think I have the same problem, I have an entity, let's say RootLayer that has a bidirectional manyToOne relationship to a MiddleLayer entity. The MiddleLayer entity has a composite key consisting of a validFrom date and the backreference to RootLayer. In addition, the MiddleLayer has a bidirectional manyToOne relationship to LeafLayer. With this setup, I can not delete an existing RootLayer object and I get the following error indicating a relationship between the audit tables and the normal tables: Referential integrity constraint violation: "FKJBI4GFCQ01BAT36P8GP8VLOJ3: PUBLIC.LEAF_LAYER_AUD FOREIGN KEY(MIDDLE_LAYER_ROOT_LAYER_FK) REFERENCES PUBLIC.ROOT_LAYER(ID) (1)
I added a zip file with my use case, I hope it is understandable. I'm using hibernate version 5.2.18.Final.
, thanks for the test case; I'll check it out soon.
The demo provided by illustrated a bug that was not addressed as part of HHH-10667. Along with fixing the foreign-key constraint issue, I've addressed the outstanding bug as a part of this issue as well.