-->
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.  [ 3 posts ] 
Author Message
 Post subject: createSQLQuery and ?
PostPosted: Wed Nov 12, 2003 10:35 am 
Newbie

Joined: Thu Sep 04, 2003 12:34 pm
Posts: 9
Hi

Right now I am doing the following in Hql:

String hqlquery ="select ms from ms in class com... where id<? and val=? ";
Object[] param = ...;
Type[] paramTypes = new Type[param.length];

for (int i = 0; i < paramTypes.length; i++) {
paramTypes[i] = Hibernate.STRING;
}

result = sess.find(hqlquery, param, paramTypes);

I need to pass that to sql, so createSQLQuery is my way. But I cannot see how I can use createSQLQuery with ? instead of named parameter, I could not find any example.

Is it possible?

tia


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 1:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes it is posssible - and look in the unit tests.

But why use ? parameters when you can get use (the IMHO better) named parameters?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 12, 2003 1:21 pm 
Newbie

Joined: Thu Sep 04, 2003 12:34 pm
Posts: 9
thanks, I will look there?

The reason to use ? instead of named parameters is that I have a leghtly piece of code that creates an hql query based on the user selected stuff on the gui. It works, I will touch it as little as possible...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.