views:

27

answers:

2

Hello,

I am using "double" in Hibernate .hbm.xml files, and when I generate classes with Hibernate Tool I get class property which has primitive type double. I want this property to be java wrapper type Double. How can I achieve this? If I change this manually in my classes, is it going to give any issues to hibernate?

Thanks

A: 

It only issue you could have is if your property is null amd the column is declared as not null. So I would advise you to always initialize it.

Maurice Perry
A: 

I am using "double" in Hibernate .hbm.xml files, and when I generate classes with Hibernate Tool I get class property which has primitive type double. I want this property to be java wrapper type Double. How can I achieve this?

Is the property nullable in the hbm.xml mapping? If it is, you should get a Double.

If you can't change the mapping, you could override the default behavior:

  • override the column specifically in reveng.xml
  • use a type-mapping and not-null set to false to handle it for all columns
Pascal Thivent