How to make query on a property from a joined table in Hibernate using Criteria
- by Palo
Hello,
I have the following mapping:
<hibernate-mapping package="server.modules.stats.data">
<class name="User" table="user">
<id name="id">
<generator class="native"></generator>
</id>
<many-to-one name="address" column="addressId" unique="true" lazy="false" />
</class>
<class name="Address" table="address">
<id name="id">
<generator class="native"></generator>
</id>
<property name="street" />
</class>
</hibernate-mapping>
How can I do a Criteria query to select all users living on some street?
That is create Criteria query for this SQL:
Select * from user join address on user.addressId = address.id where address.street='someStreet'