I have seen a thread about
id being a keword in HQL, couldn't find it though...
Code:
<hibernate-mapping>
<class name="User" table="STAFF">
<id name="sid" column="sid" type="int" unsaved-value="0">
<generator class="sequence">
<param name="sequence">staff_seq</param>
</generator>
</id>
<property name="id"/>
<property name="password"/>
<property name="firstName"/>
...
I have a property
sid, which is the Primary Key for the class and another property called
id.
Hibernate generates the following SQL:
Code:
select ... from STAFF user0_ where (user0_.sid=? )
when executing:
Code:
q = session.createQuery("from User as u where u.id = :name");
q.setString("name", id.toUpperCase());
Is
u.id referencing to the User object
id property (my expectation) or the
id column (
sid property) as specified in the mapping document .
Does that mean that I can't reference a property named
id when HQL-ing?
Thanks