Hibernate version: 3.1.2 (Annotations 3.1beta8)
I was wondering whether anyone knows whether it is at all possible to create different ids in both a base and subclass. Obviously both ids are distinct and independently maintained. I have:
@Entity
@TableGenerator (...)
@Table(name="...")
@Inheritance(strategy = InheritanceType.JOINED)
public class BaseClass {
private int id;
...
@Id @GeneratedValue(strategy=GenerationType.TABLE, generator="...")
public int getId() {
return id;
}
}
@Entity
@TableGenerator (...)
@Table(name="...")
public class SubClass extends BaseClass {
private int anotherId;
...
@Id @GeneratedValue(strategy=GenerationType.TABLE, generator="...")
public int getAnotherId() {
return anotherId;
}
}
but when I run this I get:
org.hibernate.AnnotationException: Unable to define/override @Id(s) on a subclass: some.package.SubClass
Reason why I need this is not by design but rather that I'm mapping to existing data and this is how it was designed and organised.
I'd be grateful for any pointers!
|