java - Auditing @Embeddable @ElementCollection with hibernate-envers -


i have en entity containing @embeddable @elementcollection. when trying persist keep getting nonuniqueobjectexception.

@entity @audited public class entity(){      private long entityid;      @elementcollection     private set<myembeddablecollection> collections = new hashset<myembeddablecollection>();  }  @embeddable public class myembeddablecollection(){     private string myid; 

looking @ log can see envers doesn't include myid envers table. reference entity included.

[hist_entity_collections#{revision_id=defaultrevisionentity(id = 3, revisiondate = 2013-sep-04 08:44:56), revisiontyp=add, entityid=1}] 

i using hibernate-envers 4.2.0.final-redhat-1. have solution or explanation why happening?

there bug in hibernate, see here, looks problem.

here workaround:

public class fixeddefaultcomponentsafenamingstrategy extends defaultcomponentsafenamingstrategy {     @override     public string propertytocolumnname(string propertyname) {         return super.propertytocolumnname(propertyname.replace(".collection&&element.", "."));     } } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -