Register / Login
Win a copy of
this week in the
this forum made possible by our volunteer staff, including ...
Stephan van Hulst
Object Relational Mapping
MySQL Hibernate, issue with storing boolean value
posted 3 years ago
I have a boolean value in my
class which is mapped to VARCHAR in mysql table.
When i store the values its getting stored as 1 or 0. But when i read it its always being read as false.
When i update the db value to 'true' or 'false' through a query and read it in Java, its perfectly read as true or false boolean value.
So inshort, my insert thorugh java is not working, i want it to be inserted as 'true' or 'false'.
But reading is working perfectly fine if DB has 'true' or 'false' strings.
Please advice me what settings are needed in .xml mapping file to store the boolean as 'true' or 'false' in mysql instead of 1 or 0.
Thanks a lot.
snakes are really good at eating slugs. And you wouldn't think it, but so are tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
Boost this thread!
Hibernate: read-only on @Column in embedded ID composite key classes mapping exception - bug?
Do I really need indexes?
Urgent Help to call Stored Proc from Hibernate Mapping Exception.
Exception while calling stored proc from hibernate. URGENT Help