I try, but not work.
This ID is for Photo?
Quote:
crit.add(Restrictions.eq("id", id);
This is the criteria:
Code:
public Integer getTotalPhotos(User user) {
Criteria crit = session.createCriteria(Photo.class);
crit.add(Restrictions.eq("idUser", user.getIdUser()));
crit.setProjection(Projections.rowCount());
int count = ((Integer) crit.uniqueResult()).intValue();
return count;
}
The problem is the "id user" where is a FK (foreign key) in table Photo.
This is the message:
Quote:
root cause
org.hibernate.QueryException: could not resolve property: idUser of: br.com.imobiliaria.bean.Photo
How get total photos of the user with idUser or another column on Photo table?
Thanks!!