-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to enable multiple id in query cache
PostPosted: Tue Sep 20, 2005 3:06 pm 
Newbie

Joined: Tue May 04, 2004 3:32 pm
Posts: 16
Location: Iowa
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.