How do I map a CHAR(1) to a boolean using Hibernate for Java?
That's perfect. Thanks! I saw where I could create a UserType, but I figured there was an easier way now, and this was it.
ScArcher2
2009-01-15 16:44:57
For example: <property name="deleted" type="yes_no" .../>
Nick Holt
2009-07-06 11:09:17
<property name="expired" column="EXPIRED" type="yes_no" />When I do this I get this error , I have my variable as boolean and db type as char(1)[9/30/09 15:25:41:258 PDT] 0000003f SystemErr R at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:262)[9/30/09 15:25:41:258 PDT] 0000003f SystemErr R at com.ibm.db2.jcc.c.t.a(t.java:16) This is killing me..!!!
Broken Link
2009-09-30 22:30:03
+2
A:
CharBooleanType is probably what you are looking for http://www.hibernate.org/hib_docs/v3/api/org/hibernate/type/class-use/CharBooleanType.html
edit: dtsazza's answer is probably more useful if you just want to get going and use characters y/n or t/f. If those don't match your usage you can implement your own type using CharBooleanType.
Simon Groenewolt
2009-01-15 16:38:52
Thanks! I knew I could use a UserType, but I thought there may be a simpler way, and dtsazza gave me what I needed.
ScArcher2
2009-01-15 16:58:34