Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I am trying to cache stored procedure query result set. The result set contains more than one unique identities. For example, it has a userID and loginID. Both of them are unique. Sometimes the query is given a userID and in other cases the query is given a loginID.
In the query mapping file (hbm), I can only define one id field, right? So, I define userID as the id. However, when I call the query with a loginID given, it seems alway hitting the database. I really wish that no matter whether the userID is given or loginID is giben, hibernate would search the query cache first.
My question is: is this normal? The hibernate caches things by object id, can it use more than one object ids?
The other question is a little different. It is still about query cache. But I want a query to take either a unique id or a non-unique field as parameter. If I run the query by giving a non-unique filed, since it is not the object id, can hibernate find it in the cache? Or the hibernate just simply goes to the database to find it?
Thanks.