Skip to content

Instantly share code, notes, and snippets.

@emmanuelbernard
Forked from sebersole/gist:6391452
Last active December 22, 2015 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emmanuelbernard/6391475 to your computer and use it in GitHub Desktop.
Save emmanuelbernard/6391475 to your computer and use it in GitHub Desktop.
@Embeddable
class Address {
...
@Convert(...) private String city;
}
@Entity
@Convert(attributeName="homeAddress.city", disableConversion=true)
class Person {
...
private Address homeAddress;
}
<entity class="Person">
<attributes>
<embedded name="homeAddress">
<convert attributeName="city" .../>
</embedded>
</attributes>
</entity>
//as if the XML mapping was done in annotations
@Embeddable
class Address {
...
@Convert(...) private String city;
}
@Entity
@Convert(attributeName="homeAddress.city", disableConversion=true)
class Person {
@Convert(...)
private Address homeAddress;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment