Hi all,
I need help on a criteria i am trying to add to make a query.
I have these two objects, Policy and Product:
Code:
public class Policy {
private int id;
private Product product;
private int conversionAttempts;
...
}
public class Product{
private int id;
private Date creationDate;
...
}
This is my mapping for the relation between the two objects:
Code:
<class name="Policy" table="policy_status">
<id name="id" type="int" column="policy_status_id">
<property name="conversionAttempts" column="conversion_attempts" />
<many-to-one name="product" column="product_scheme_id" class="Product" lazy="false" cascade="none" not-null="true" />
And i also have the mapping of the Product which contains a creation date.
I am then trying to add the following expression:
criteria.add(Expression.eq("product.creationDate", date));
But it fails complaining that it does not know the property product.creationDate.
And i am 100% sure that it is not a spelling error.
Apparently the creation date is not known for the Policy, only the whole product object is.
How can i add a criteria where i want all the Policies, that have a certain product creation date ?
Hope someone has the answer.
Best Regards
Cemil[/b]