I have three entities using JPA/EclipseLink:
@Entity(name = "Sharing")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class AbstractSharingEntity extends AbstractEntity {
@Entity(name = "InternalSharing")
public class InternalSharingEntity extends AbstractSharingEntity {
@Entity(name = "ExternalSharing")
public class ExternalSharingEntity extends AbstractSharingEntity {
If I create a typed query for AbstractSharingEntity ("... FROM Sharing ..."), EclipseLink creates the correct query using the specified entity name.
But if I create a typed query for one of the two subclasses (e. g. "... FROM InternalSharing ..."), EclipseLink creates a wrong query using the class name as table name instead of using the entity name. This results in the following error:
java.sql.SQLSyntaxErrorException: Table 'db.ABSTRACTSHARINGENTITY' doesn't exist
Did I make any mistake and this is the expected behaviour? How can I create valid queries for the subclasses without changing the class names/removing different entity names?