-->
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: How to get primitive boolean type for yes_no using hbm2java
PostPosted: Thu Dec 21, 2006 4:38 am 
Newbie

Joined: Thu Dec 21, 2006 3:48 am
Posts: 1
Hi all!
We are working with Hibernate 3.2.0 and Hibernate Tools 3.2.0 beta 8 (starting with ant).

We have an oracle database (V.9.2) using varchar(1) to hold boolean values.

I try following mapping:

(...)
<property name="integrated" type="yes_no">
<column name="C_INTEGRATED" length="1" not-null="true" />
</property>
(...)


Running hbm2java gives following java code:

(...)
private Boolean integrated;
(...)
public Boolean getIntegrated() {
return this.integrated;
}

public void setIntegrated(Boolean integrated) {
this.integrated = integrated;
}
(...)



I expect that the primitive boolean type should be generated (because not-null="true").
Did I forget anything?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 22, 2006 7:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hbm2java listens to the return type of getReturnedClass() of a type and that is in this case Boolean for YesNoType.

you can override it by adding <meta attribute="property-type">boolean</meta>

_________________
Max
Don't forget to rate


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.