Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Get specific entries from a Table using the "InheritanceType.SINGLE_TABLE-strategy" by using the DiscriminatorValue

Hello everyone,

I've a class Person and a class Employee.
Employee is extended from the class Person.
Person has its own Table, using "InheritanceType.SINGLE_TABLE" as Inheritance strategy.
Employee entries are thus also stored in the table of Person.

However, I couldn't find the magic SELECT query for EclipseLink to get only the Employee-entries from the table Person.

PostgreSQL finds "SELECT person.* FROM Person person WHERE person.dtype = 'Employee';" very delicious and gives me the right results. But EclipseLink is less nice and doesn't want to see the DiscriminatorColumn "dtype" when I do "List<Employee> employees = (List<Employee>) em.createQuery("SELECT OBJECT(Employee) FROM Person person WHERE person.dtype = 'Employee';").getResultList();".

Trying to cast 'Employee' to CHARACTER VARYING(31) in various ways didn't also work.

Does anyone have a suggestion to solve this?

Thanks in advance,

Rick

Back to the top