Wednesday, May 16, 2012

Inheriting mapping annotations

I'm working on a JPA project in which I have some different Entities extending a super-class annotated as Entity:



@Entity
@Table(name = "export_profiles")
@NamedQueries({
@NamedQuery(name = "ExportProfile.getAll", query = "select ep from PersistentExportProfile ep"),
@NamedQuery(name = "ExportProfile.getByName", query = "select ep from PersistentExportProfile ep where ep.profileName = :name") })
public abstract class PersistentExportProfile extends AbstractExportProfile {

// other mappings...

}


I'd like to inherit mappings defined in my PersistentExportProfile into each sub-class.
Is it possible? What do I have to change in my super-class, and what do I have to add in my sub-entities?



NOTE all the sub-classes will be mapped on the same table.





No comments:

Post a Comment