• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown

Spring JDBC Integer Object + Null Value

Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends,

I'm trying to insert a record into a database using spring JDBC template. In our table there is a column 'VERSION' with data type as NUMBER. We're using Oracle 10g Database.

This is the Value object declaration:

I'm setting the 'VERSION' column value like this:

The 'VERSION' column is a NULLABLE column. There must be null value in a specific business scenario. The problem is instead of 'null' the column is getting updated as '0'. I checked the SQL that is getting executed and the query doesn't contain the 'VERSION' column itself in the insert query.

But if I change the 'version' type as 'String' in value object and do preparedStatement.setString(5, valueObj.getVersion()); , the 'VERSION' column is having the null value correctly.

My problem is even if I use Integer object the 'VERSION' column should have null value in the database.

Can you please resolve me this issue?

I AM MIGHTY! Especially when I hold this tiny ad:
a bit of art, as a gift, that will fit in a stocking
    Bookmark Topic Watch Topic
  • New Topic