Register / Login
this forum made possible by our volunteer staff, including ...
Stephan van Hulst
Object Relational Mapping
MySQL Hibernate, issue with storing boolean value
posted 9 months 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.
It is sorta covered in the
JavaRanch Style Guide
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