Hi,
It's possible to apply some automatic conversion logic when binding parameters?
For example if I apply a Integer parameter to Long column, or String to Integer, with the setParameter(), can Hibernate automatically convert it to the correct type, or can I inject some conversion logic? Because I get classcastsexception like that: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long at org.hibernate.type.LongType.set(LongType.java:42)
I know how to convert the values, but the problem is that I don't know to what type I've to convert. I've looked at setParameter code and I've seen that when you set the parameter Hibernate knows the real type of the parameter and stores it in ParametersMetadata, but the problem is that I've seen any exposed method to retrieve that information.
Something like, what is the type of parameter named 'xxxx'?
Also I've seen that LongType and similar, have a fromStrimg method? But it doesn't seem to be used, is it?
Cheers,
|