* Hibernate version: 3.1 *
* Annotations version: 3.1beta6 *
I have a table with two columns which are both part of a composite key, it is infact a join table. I didn't know know how to define the primary key except creating a different id-class (which will look the same like the first class - same properties, same methods), so I tried this:
@IdClass(MyClass.class)
public class MyClass implements Serializable {
...
}
And it's working. Is it ok to use @IdClass on self in situations like this or is there another preferable way?
Thank you.
|