Does JPA or OpenJPA have support for what is called unknown primary key in the EJB CMP 2.0 spec. An unknown primary key is the pk of an entity bean that does not have a field (or abstract getter/setter) for a primary key. Instead the framework adds a virtual field to the bean that contains the primary key. The bean can get access to the primary key instance calling "Object EntityContext.getPrimaryKey()". Typically, the unknown primary key is implemented using database identity and a java.lang.Long.

I can add a real field to the class via byte code transformation for CMP1 entity beans, but would perfer not to. For CMP2, I'm already generating a subclass so I already have a place to put the field.

Thanks,

-dain

Reply via email to