Is it possible for a JPA entity class to contain two built-in fields ( @Embedded )? An example is:
@Entity public class Person { @Embedded public Address home; @Embedded public Address work; } public class Address { public String street; ... }
In this case, a Person can contain two instances of Address - home and work. I am using JPA with the implementation of Hibernate. When I generate a circuit using Hibernate Tools, it includes only one Address . I would like for two built-in instances of Address , each with column names that have been marked or pre-entered in the prefix (for example, home and work). I know @AttributeOverrides , but it requires each attribute to be individually overridden. This can become cumbersome if the built-in object ( Address ) becomes large, since each column must be individually redefined.
java java-ee hibernate jpa
Steve Kuo Dec 01 '08 at 18:31 2008-12-01 18:31
source share