-->
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: problem using boolean in mapping file for MySQL
PostPosted: Sun Aug 22, 2004 7:41 am 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
Hi,

Using latest Hibernate 2, I have a mapping file with this entry:

<property name="Core" type="boolean" column="iscore"/>


Now in my code I do a query expressed in OQL:

"select grp from " + SportletGroup.class.getName() + " grp where grp.Core='" + Boolean.TRUE + "'"


This works fine when using hsqldb, however it seems that using MySQL a boolean gets mapped to a tinyint, so that the query will work only if "1" is used instead of "Boolean.TRUE", however this will then break the query under hsqldb. Is there any db agnostic way to handle boolean types, or maybe I should declare the field as an integer?

Thanks, Jason


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 22, 2004 7:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
hibernate.query.substitutions


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 22, 2004 8:16 am 
Beginner
Beginner

Joined: Sun May 02, 2004 8:04 am
Posts: 36
Thanks Gavin!

One more dumb question-- I'm using java style hibernate.properties file, will this work:

hibernate.query.substitutions=true 1, false 0

Thanks again, Jason


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.