-->
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.  [ 8 posts ] 
Author Message
 Post subject: How to query Boolean field ????????
PostPosted: Tue Dec 07, 2004 5:41 am 
Beginner
Beginner

Joined: Sun Sep 07, 2003 9:04 am
Posts: 48
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:

Hello i am trying to do following but I have a symtax error
My problem is that i want to query an boolean field in my db how do I do that ? by following the bellow method.


List isDefaultReason =session.
find("select activationReason.oid from com.zonith.power.model.ActivationReason as activationReason where activationReason.isDefaultReason=?",
activationReason.isIsDefaultReason(),Hibernate.BOOLEAN);

activationReason.isDefaultReason; isDefaultReason is the boolean field in the db.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 7:09 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Is it boolean in hibernate mapping ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 7:13 am 
Beginner
Beginner

Joined: Sun Sep 07, 2003 9:04 am
Posts: 48
snpesnpe wrote:
Is it boolean in hibernate mapping ?

Yes the boolean is in the hibernate mapping


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 7:14 am 
Beginner
Beginner

Joined: Sun Sep 07, 2003 9:04 am
Posts: 48
seybaa wrote:
snpesnpe wrote:
Is it boolean in hibernate mapping ?

Yes the boolean is in the hibernate mapping


The problem is how do I convert
activationReason.isIsDefaultReason() this method the return a true or false to a String ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 7:18 am 
Beginner
Beginner

Joined: Sun Sep 07, 2003 9:04 am
Posts: 48
seybaa wrote:
seybaa wrote:
snpesnpe wrote:
Is it boolean in hibernate mapping ?

Yes the boolean is in the hibernate mapping


The problem is how do I convert
activationReason.isIsDefaultReason() this method the return a true or false to a String ?


activationReason.isIsDefaultReason() this method retrun a true or false
my question is how do I type cast it to String ,as far as I can se List isDefaultReason =session.
find() wants a String type argument.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 7:19 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
If activationReason.isIsDefaultReason() is boolean then query have to work - If isn't boolean then you have to convert method return type in boolean

regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 7:52 am 
Beginner
Beginner

Joined: Sun Sep 07, 2003 9:04 am
Posts: 48
snpesnpe wrote:
If activationReason.isIsDefaultReason() is boolean then query have to work - If isn't boolean then you have to convert method return type in boolean

regards

activationReason.isIsDefaultReason() is a boolean type, but my eclispe has a compiling error
saying that Remove arguements to match find(String)

or change return type of activationReason.isIsDefaultReason() to much object.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 9:03 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
try cast

Code:
find("select activationReason.oid from com.zonith.power.model.ActivationReason as activationReason where activationReason.isDefaultReason=?",
(Object) activationReason.isIsDefaultReason(),Hibernate.BOOLEAN);


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