views:

73

answers:

1

Using EJB3/JBoss, how can I use a composite element from a table, e.g.

@Entity
public class X {
   @Id
   private int id;
   private Coordinate coordinate;
}

where Coordinate is a defined as (setters/getters left out for readability):

public class Coordinate {
    int x;
    int y;
}

And everything should be mapped to Table X which contains columns id, x, y.

+1  A: 

Look at the @Embedded and @Embeddable annotations.

Mykola Golubyev