Polymorphic query doesn't return all objects it should return
-------------------------------------------------------------
Key: HHH-3470
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3470
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.6
Environment: Window Vista, Maven 2.0.9, Eclipse Ganymed, Hibernate 3.2.6.ga,
Sping 2.5.5, hsqldb
Reporter: Jens Laufer
Attachments: hibernate-polymorphic-query-test.zip
I have got an abstract class (Address) with three implementations (PostalAddress,
FaxNumber, PhoneNumber).
The FaxNumber and the PhoneNumber have a property number. PostalAddress has some more
properties (name, postalCode, city, addressLine).
In the hibernate mapping I am having a inheritance mapping with joined-subclass. In case I
am persisting three objects (a PostalAddress, a PhoneNumber and a FaxNumber) and I build a
query that has a wildcard search on all properties of the mentioned objects I am just
getting two objects backs. PostalAddress
is returned plus either PhoneNumber or FaxNumber. Which second object is returned depends
on what is defined first in the mapping file. If define Phonenumber first, the PhoneNumber
is returned but not the FaxNumber.
The query is: FROM Address WHERE number LIKE :query OR postalCode LIKE :query OR name LIKE
:query OR city LIKE :query OR addressLine LIKE :query
I attached a litte test project with a unit test, that proofs this. The project can be
imported into eclipse or the test can be run during the maven2 built.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira