• 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

Leading zero's being trimmed off

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic