I'm trying to map a legacy object model using Hibernate/JPA annotations, and I have a rather peculiar requirement regarding one of the entity's primary keys - the actual entity ID is contained within a component object, but this component object contains other non-key properties.
For example:
@Entity
public class MyEntity {
@EmbeddedId
private MyComponent component;
}
public class MyComponent {
private String id;
private String someOtherThingThat'sNotAKey;
}
With this set up, every property of MyComponent becomes part of the entity identifier, whereas what I need is for only component.id to form the identifier, and for the other properties of component tp be stored as normal embedded properties.
Is this stretching things too far?
|