| Again, the Dialect should not be involved. As an example of why... on Oracle you might choose to map a Boolean as a CHAR (y/n, Y/N, t/f, T/F), a NUMERIC (0/1), etc. And you might choose different mappings for different attributes/columns. Again, this is what JPA misses in terms of defining these in terms of just a Java class. To work around this you'd have to tell Hibernate which specific org.hibernate.type.Type to use. There are a few ways to achieve that
- if you consistently use the same mapping for all booleans in your application, the easiest would be to adjust the BasicTypeRegistry when your application starts up. Just register the specific org.hibernate.type.Type implementation you want it to use against Boolean.class (by default we map to the JDBC BOOLEAN type).
- you could also handle this specific to the query/binding. This requires Hibernate-specific calls though. Either:
- from the StoredProcedureQuery obtain Hibernate's ProcedureCall. This allows you to define the Type as you register the parameter
- ...
|