Hello,
I have a problem with the following schema:
Code:
Class X {
String a;
String b;
}
a and b make the class' composite key.
I could work without a problem with that class using a hibernate mapping file.
Code:
<hibernate-mapping>
<class name="X">
<composite-id>
<key-property name="a" type="string">
</key-property>
<key-property name="b" type="string">
</key-property>
</composite-id>
</class>
</hibernate-mapping>
When I tried to use annotations instead (starting a move towards ejb3 annotations), I couldn't make it work.
I tried something like
@Entity
@Embeddable
@IdClass(X.class)
public class X
returns:
org.hibernate.AnnotationException: No identifier specified for entity: X
If I add @Id to both properties, I have:
Caused by: org.hibernate.AnnotationException: X has not persistent id property
when creating the annotation configuration instance.
Is this too weird?
I'd like to avoid duplicating the class just to have a PK class...