[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1851) relax special handling of 'id' property

Alex Milanovic (JIRA) noreply at atlassian.com
Sun Oct 3 18:55:57 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1851?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=38599#action_38599 ] 

Alex Milanovic commented on HHH-1851:
-------------------------------------

I am using 3.5.6 and I think I am running into this problem. I call on query.iterate() method and when I try to access the first row in the result set Hibernate complains that it can't find the object. If I understand it correctly, Hibernate first retrieves the IDs and then the actual objects by their ID as one iterates through the list. Now, as my objects have both a property named ID (name="id") and an <id> property Hibernate uses the wrong ID (property named ID instead of the <id> property) and thus ends up not finding the object. 

Any clue when the fix might be released?

> relax special handling of 'id' property
> ---------------------------------------
>
>                 Key: HHH-1851
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1851
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: query-hql
>         Environment: independent, all versions all databases.
>            Reporter: Gunther Schadow
>            Assignee: Steve Ebersole
>             Fix For: 3.5.x
>
>         Attachments: IdClassAndAnotherPropertyNamedId.zip
>
>
> Hibernate has long treated 'id' in a special manner in HQL and Criteria queries.  The drawback to this has always been that it effectively means users cannot define non-identifier properties named id and refer to those properties in HQL/Criteria queries.
> Thus, I will change this such that:
> (1) 'id' can still be used to refer to the identifier property, whatever the property's actual name, as long as the entity does not define a non-identitifer property named id.
> (2) if the entity defines a non-identifier property named 'id', using 'id' in HQL or Criteria queries will refer to this non-identifier property; users would need to refer to the identifier property by its actual name.
> FYI, the original reason for this feature was to support entity's which did not define an identifier property at all (users were responsible for managing the ids seperately.  That feature was never really recommended and has been deprecated since early in the 3.x development.  

-- 
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list