<p>Is it possible for a JPA entity class to contain two embedded (<code>@Embedded</code>) fields? An example would be:</p>

<pre><code>@Entity
public class Person {
    @Embedded
    public Address home;

    @Embedded
    public Address work;
}

public class Address {
    public String street;
    ...
}
</code></pre>

<p>In this case a <code>Person</code> can contain two <code>Address</code> instances - home and work. I'm using JPA with Hibernate's implementation. When I generate the schema using Hibernate Tools, it only embeds one <code>Address</code>. What I'd like is two embedded <code>Address</code> instances, each with its column names distinguished or pre-pended with some prefix (such as home and work). I know of <code>@AttributeOverrides</code>, but this requires that each attribute be individually overridden. This can get cumbersome if the embedded object (<code>Address</code>) gets big as each column needs to be individually overridden.</p>

If you want to have the same embeddable object type twice in the same entity, the column name defaulting will not work: at least one of the columns will have to be explicit. Hibernate goes beyond the EJB3 spec and allows you to enhance the defaulting mechanism through the NamingStrategy. DefaultComponentSafeNamingStrategy is a small improvement over the default EJB3NamingStrategy that allows embedded objects to be defaulted even if used twice in the same entity.
From Hibernate Annotations Doc:
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#d0e714