Hello,
>From research online, the following pattern seems to be valid JPA:
public abstract class Identifiable<T> {
private T id;
@Id
public T getId() { return id;}
private void setId(T t) { id = t; }
}
@Entity
@AttributeOveride(name="id", colu...@column(name="someColumnID"))
public class Cats extends Identifiable<Integer> {
...
}
*OR*
public class OtherThing extends Identifiable<OtherThing.PK> {
@Embeddable
protected static class PK {
...
}
...
}
However, OpenJPA gives the following (cryptic?) exception:
Superclass field "java.lang.Object.id" is mapped in the metadata for
subclass "Cats", but is not a persistent field.
"id" isn't even in java.lang.Object, so I'm having problems understanding
what the exception means.
According to the penultimate post in this thread:
http://forums.sun.com/thread.jspa?threadID=5268944
Hibernate's JPA implementation supports the above pattern.
Thanks!
atanamir
--
View this message in context:
http://openjpa.208410.n2.nabble.com/Generic-MappedSuperclass-tp5021841p5021841.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.