Hyperjaxb3 supports JPA 2 since version 0.5.6.
Use the jpa2 variant to generate JPA 2 annotations:
|Hyperjaxb3 can generate JPA 2 annotations as well as XML mapping files according to the JPA 2 according to the JPA 2 orm_2_0.xsd XML schema. Use <result>mappingFiles</result> or -Xhyperjaxb3-jpa2-result=mappingFiles configuration items accordingly.|
JPA 2 supports collections of simple types using the @ElementCollection annotation.
Hyperjaxb3 uses this feature to improve mapping of the repeatable simple type elements.
In JPA 2, @Embeddable mechanism is much more powerful when compared to to JPA 1. Embeddable classes can now have complex properties, associations, collections - and even nested embeddables.
Hyperjaxb3 now supportes @Embeddable features.
Note that both PersonType as well as AddressType are embeddable. Moreover, PersonType has a nested embeddable (address).
Here's how it looks like in the database:
Note that column names for both embeddable AddressType fields do not collide.