hibernate - How to declare a collection of embeddables which are embedded in another class -
i've got following classes:
and following java code:
@entity class person implements serializable { // ... @embedded private address address; // ... } @embeddable class address implements serializable { // ... @manytoone @joincolumn(name = "cityid") private city city; } @entity class city implements serializable { // ... // correct way? @onetomany(mappedby = "city") private list<address> addresses; // or should this? // @onetomany(mappedby = "???") // private list<person> persons; // ... }
my question is: should city class contain collection of addresses or collection of persons? can choose?
Comments
Post a Comment