• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting default value for a column

 
Harjit Singh
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I have a column in the DB which is number(8,0) The type in the POJO is long. This is an optional value, is there any way I can set NULL for this column where there is no data, right now its being set to 0 when there is no data.

Thanks

- Harjit
 
Shailesh Kini
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harjit,

I haven't tried this myself so cannot say for sure if it would work. Can you please try to use a Long object instead of a primitive long? By default primitve long and int variables are assigned a value of 0. Objects on the other hand are assigned a null value.
 
Harjit Singh
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will try that and see if that works....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic