• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NULL values with hibernate

 
anuja Edathu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am persisting an object using Hibernate.In the database one field(which is of number(2,1) can be null also. It is declared as float in the java bean for mapping;If the value becomes null,the types won't be matching.Is there any way to incoorporate null values also.

Tanks & Regards
Anuja K.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Float in Java that is set to null is still a Float. So just don't set that attribute to a value and NULL will be inserted into the database for that field.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic