[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7046) Polymorphic query by natural ID broken
Emanuel Kupcik (JIRA)
noreply at atlassian.com
Thu Feb 9 10:36:10 EST 2012
Polymorphic query by natural ID broken
--------------------------------------
Key: HHH-7046
URL: https://hibernate.onjira.com/browse/HHH-7046
Project: Hibernate ORM
Issue Type: Bug
Environment: Hibernate 4.1.0
Reporter: Emanuel Kupcik
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: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list