-->
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.  [ 4 posts ] 
Author Message
 Post subject: Convert session.Find to session.CreateSQLQuery
PostPosted: Wed Jan 04, 2006 9:36 am 
Newbie

Joined: Wed Jan 04, 2006 9:27 am
Posts: 2
Location: Norway, Oslo
I want to convert
Code:
session.Find(txn, "from t in class NHibernate.TopicDataObject where " + "  t.ObjectId = ? and t.TopicMap = ?", new Object[]{id, tmdo}, new IType[]{NHibernateUtil.String, NHibernateUtil.Entity(typeof(TopicMapDataObject))})
to
Code:
session.CreateSQLQuery(..?..)

I want to do this so that I can cache the query. What is the best way to convert this?

_________________
TMNet


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 10:21 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
You don't need to use SQL to make the query cacheable, just use session.CreateQuery("<your HQL here>").SetCacheable(true);


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 11:56 am 
Newbie

Joined: Wed Jan 04, 2006 9:27 am
Posts: 2
Location: Norway, Oslo
It's the HQL syntaxs that I'm wondering about. How can I translate the one inside the Find(..) to a HQL for the CreateQuery()?

_________________
TMNet


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 04, 2006 4:12 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Jorgen wrote:
It's the HQL syntaxs that I'm wondering about. How can I translate the one inside the Find(..) to a HQL for the CreateQuery()?


CreateQuery uses HQL, you don't need to translate anything.


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

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.