• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring JDBC Integer Object + Null Value

 
Ranch Hand
Posts: 186
Java
  • 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?

Thanks,
Vijay
 
reply
    Bookmark Topic Watch Topic
  • New Topic