[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-7046) Polymorphic query by natural ID broken
Steve Ebersole (JIRA)
noreply at atlassian.com
Thu Feb 9 11:25:10 EST 2012
[ https://hibernate.onjira.com/browse/HHH-7046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45486#comment-45486 ]
Steve Ebersole commented on HHH-7046:
-------------------------------------
Thanks Emanuel. I know exactly where that is.
> 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
>
> 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