Reputation: 31
I have table Users which contains column iduser
(long) fk -> to table login to column id_user
(long).
But I don't want to map table login into users. I just want to use this column iduser
in Users like normal column and find specific object.
When I wrote something like this:
...
criteria.add(Restrictions.eq(ID_USER, (long) 3);
...
The error will appear:
could not resolve property: iduser of: model.domain.User
But when I used standard SQLQuery
:
Query query = session.createSQLQuery("select * from Users where iduser = 3");
List list = query.list();
it will found the specific object.
Any ideas how to solve this problem?
Upvotes: 0
Views: 2494
Reputation: 42084
Names of the persistent attributes are case sensitive. Because name of the attribute is idUser
, it is expected that attribute iduser
(lower case 'u') cannot be found. When Criteria or HQL is used, it is names of the attributes, not the names of the database columns that matters.
Upvotes: 2