hibernate - How to declare a collection of embeddables which are embedded in another class -


i've got following classes:

embeddable example

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

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -