Listing 1
@Entity
public class Customer {
private Address address;
...
@Dependent({
@DependentAttribute(name="street", column={@Column("STREET")}),
@DependentAttribute(name="city", column={@Column("CITY")}),
@DependentAttribute(name="state", column={@Column("STATE")})
})
public Address getAddress() { return address; }
...
}
Listing 2
@Entity
@Table(name="Animal")
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="TYPE")
public class Animal
{
@Id private int id;
@Column(name="AVG_WEIGHT")
private int averageWeight;
...
}
@Entity
public class Dog extends Animal
{
@Column(name="BREED")
private String breed;
...
}