Improve support for entity type expressions

Description

The JPA 2 spec has a section about entity type expressions with some examples of how they can be used.

As of (I think) 4.0.0, Hibernate supports limited use of the TYPE() operator, but it's not sufficient to run some of the examples shown.

The biggest issue is that TYPE() cannot be used in the select clause, so there is no way to determine an entities class type as part of a query.

Another, smaller, issue is that the TYPE() operator doesn't seem to work if there is no inheritance hierarchy for the entities involved (minor problem, but it can be a trap when writing generic queries).

Attached test case (Maven project) which expects a DB named 'jpatypetest' running on localhost. It has a few simple test cases related to this, only one of which succeeds (TYPE() in where clause on polymorphic query).

Side note: is there a test case template project anywhere which uses the Hibernate infrastructure test classes talked about at the following link?
http://www.hibernate.org/issuetracker

Environment

None

Assignee

Unassigned

Reporter

Keith Phillips

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure