• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Leading zero's being trimmed off

 
Carlos Juan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Oracle as backend database. Here is a issue I am facing and need some help.


I have a database table with datatype VARCHAR2(25)

In my hbm.xml I have the following:


Now if I have a value 00875. When a data is saved leading zero's are some how trimmed off and only 875 is saved in the table.
How can I make to insert 00875 without trimming off any leading or trailing zero's. Any help is appreciated.

Thanks
 
Carlos Juan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured out the root cause it's not the hibernate. I am using JAXB and any time I get a value starting with leading zero's i.e. 00785 as I have defined nonNegativeInteger in my xsd. As can't change the xsd so probably will explicitly check if the returned value is of some specific length if not then append the leading zero's, or if someone have a better solution will be more then happy to look at. Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic