-->
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.  [ 2 posts ] 
Author Message
 Post subject: Stuck on query setString
PostPosted: Thu Sep 28, 2006 4:39 pm 
Newbie

Joined: Thu Sep 28, 2006 4:24 pm
Posts: 1
Hi, I have the following table on Oracle:

test_table:
something char(10)
ID char(12) not null

Then I tried executing the code:

String result = (String)session.createQuery("SELECT test.something FROM com.blah.test AS test where test.ID = :var").setString("var","hello").uniqueResult();

There were no exceptions, but I get a null value for the string result.

However, if I hardcoded the "hello" in the SELECT statement (SELECT test.something FROM com.blah.test AS test where test.ID = 'hello'"), it will return the result.

Does anyone know why?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 28, 2006 5:28 pm 
Beginner
Beginner

Joined: Thu Aug 24, 2006 6:01 am
Posts: 49
Location: sophia-antipolis, France
I think you need to use setParameter().


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