I have the following class structure:
Code:
public class A {
private APK pk;
public APK getPK() {
return pk;
}
public void setPK(APK pk) {
this.pk = pk;
}
}
public class APK {
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
I think in Hibernate terms, this is considered a composite key, however in reality it is not, since the key consists of a single attribute/column (it's just in another class). I can map this with not problem as a composite key.
The problem is that I would like to have the
id value autogenerated using the identity feature of SQLServer 2008, however from everything I have read, this is not possible because Hibernate treats this as a composite-key and not just a component.
Is this possible to accomplish without having to implement my own classes to generate the id?
I'm using Hibernate 3, SQL Server 2008, and Java 1.5.
Thank you in advance,
Maury