Hi,
I have the following classes, the mapping with hibernate works fine but when i try to fetch by criteria as follows:
Code:
Criteria criteria = session.createCriteria(Alarm.class);
criteria.add(Expression.eq("alarmDetails.status.id", 1L));
I get the following error: org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: alarmDetails.status.id of: Alarm; nested exception is org.hibernate.QueryException: could not resolve property: alarmDetails.status.id of:
Code:
public class Alarm
{
private AlarmDetails alarmDetails;
public AlarmDetails getAlarmDetails()
{
return alarmDetails;
}
public void setAlarmDetails(AlarmDetails alarmDetails)
{
this.alarmDetails = alarmDetails;
}
}
public class AlarmDetails
{
private Status status;
public Status getStatus()
{
return status;
}
public void setStatus(Status status)
{
this.status = status;
}
}
public class Status
{
private long id;
public long getId()
{
return id;
}
public void setId(long id)
{
this.id = id;
}
}
when i create the following criteria:
Code:
Criteria criteria = session.createCriteria(Alarm.class);
criteria.add(Expression.eq("alarmDetails.status.id", 1L));
I get: org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: alarmDetails.status.id of: Alarm; nested exception is org.hibernate.QueryException: could not resolve property: alarmDetails.status.id of: