-->
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: hbm2java float type generated not nullable
PostPosted: Tue Jan 29, 2008 6:30 pm 
Newbie

Joined: Tue Jan 29, 2008 6:07 pm
Posts: 5
When generating a property with type="float", the hbm2java tool is generating code with the native "float" type, and not "Float" as it should. Since the column is nullable, this (expectedly) throws an exception when Hibernate tries to write the null value to the object. I tried to specifically use "Float" in the definition file, but Hibernate did not recognize that type. Note that the other field (type="integer") does correctly generate a Java "Integer" object (therefore allowing null).

Suggestions?

Hibernate version: 3.2.0.200801290813-nightly (also tested with 3.2.0 GA)

Mapping documents:
Code:
...
<class name="MyTable" table="MY_TABLE" mutable="false">
  <id name="id" column="id" type="integer"/>
  <property name="age" column="age" type="integer" not-null="false"/>
  <property name="weight" column="weight" type="float" not-null="false"/>
</class>
...


Generated code:
Code:
...
private Integer id;
private Integer age;
private float weight;
...


Database: Oracle 10g


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 31, 2008 8:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use type="java.lang.Float" if you want that.

_________________
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.