-->
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: native SQL set :parameter is null oder is not null
PostPosted: Fri Apr 08, 2011 8:17 pm 
Newbie

Joined: Fri Apr 08, 2011 8:09 pm
Posts: 2
hallo,

i have this HQL native SQL-Statement:

SELECT * FROM Tabelle
WHERE oe = :oe
AND druckdatum:druckdatum

my java query looks like this:

if(printID==1) {
query.setParameter("druckdatum", "is not null");
}
else {
query.setText("druckdatum", "is not null");
}

The value is null or is not null generate in the statement with quotes "is null" or "is no null". I need the value "is null" without quotes.


Top
 Profile  
 
 Post subject: Re: native SQL set :parameter is null oder is not null
PostPosted: Wed Apr 13, 2011 8:07 am 
Newbie

Joined: Tue Sep 14, 2010 4:29 pm
Posts: 16
Hallo Psalidaki,

is null or is not null cannot be set as parameters for queries. You'll have to write them as statements. E.g.
Code:
SELECT * FROM Tabelle
WHERE oe is not null
AND druckdatum:=druckdatum


If you want all possible combiantions, that means writing 4 separate SQL-Queries. If you want more flexibillity concerning your parameters, you should consider switching to Criteria-Queries.

Cheers ngomo

_________________
http://www.winfonet.eu


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.