Hello
I have the following mapping:
Code:
<class name="User" table="USER">
...
<one-to-one name="person" class="Person"/>
</class>
<class name="Person" table="PERSON">
...
<component name="address" class="Address">
...
<property name="city" type="string" column="CITY"/>
</component>
</class>
I try to build a Criteria query knowing the city:
Code:
DetachedCriteria detachedCriteria = DetachedCriteria
.forClass(User.class)
.createAlias("person", "p")
.createAlias("p.address", "a")
.add(Restrictions.like("a.city", myCity);
The error I get is:
could not resolve property: address of: Person
What am I doing wrong?