]
Steve Ebersole resolved HHH-7046.
---------------------------------
Resolution: Fixed
Fix Version/s: 4.1.1
Polymorphic query by natural ID broken
--------------------------------------
Key: HHH-7046
URL:
https://hibernate.onjira.com/browse/HHH-7046
Project: Hibernate ORM
Issue Type: Bug
Affects Versions: 4.1.0
Environment: Hibernate 4.1.0
Reporter: Emanuel Kupcik
Assignee: Steve Ebersole
Fix For: 4.1.1
Time Spent: 0.7h
I have a simple class hierarchy that is mapped as joined subclass
class Principal
{
String uid;
}
class User extends Princpal
{
}
class Group extends Princpal
{
}
Till 4.0 it was possible to retrieve a user the natural ID using a criteria query for
User.class and using uid as natural ID. In 4.1 this fails because Hibernate complains that
column user_.uid doesn't exist. I can can still retrieve the user by using a criteria
query for Principal.class.
So this works
Criteria loCriteria = loSession.createCriteria(Principal.class);
loCriteria.add(Restrictions.naturalId().set("uid", aUID));
and this no longer works
Criteria loCriteria = loSession.createCriteria(User.class);
loCriteria.add(Restrictions.naturalId().set("uid", aUID));
Hibernate knows the correct name of the column from the mapping file but in the end it
looks for it in the wrong table
--
This message is automatically generated by JIRA.
For more information on JIRA, see: