Saturday, August 20, 2016

HIBERNATE: Two Value Objects inside One Entity

WHAT IF THERE ARE TWO VALUE OBJECTS (or EMBEDDED OBJECTS) OF THE SAME TYPE LIKE BELOW?



  • The relational schema for this one is not possible as the column names are already used up by the time the first value object is mapped to the table. 
  • This requires renaming of the columns through @AttributeOverride annotation. 
  • A plural of this annotation, i.e. @AnnotationOverrides is used to bundle up a bunch of such renaming overrides as below...


No comments:

Post a Comment