When I run an Informix SQL query through Hibernate, it seems to be mis-casting all char(n) fields as Character and not String. How can I tell Hibernate to cast all fields defined as char(n) as a String?
This isn't particularly helpful. So the string "Hello World" if stored in a char(20) fields becomes "H".
Yes, I know I can correct this by adding scalars to the SQLQuery, but when you've done it to 200 queries already, and I would like to be able to execute user SQLs (where the type is not necessarily known), it gets very annoying!
I think I can actually see the error in the dialect code!
registerColumnType(Types.CHAR, "char($l)");
Should be something like
registerColumnType(Types.VARCHAR, "char($l)");
registerColumnType(Types.CHAR, "char(1)");
(not sure how precedence works here).
Alternatively, how do I get a raw, simple JDBC connection out of hibernate? We're using JPA persistence coupled to hibernate - is there any way to get a simple JDBC connection from it to work around Hibernate bugs?
|