I have a query with a bunch of joined tables, and have traditionally used the aliasToBean result transformer for such purposes. However, requirements recently had me stick a CLOB into this bean. I am mapping it to a String (though i also tried Object and that didn't work either). The error is:
Code:
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.6.0]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) ~[?:1.6.0]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) ~[?:1.6.0]
at java.lang.reflect.Method.invoke(Method.java:611) ~[?:1.6.0]
at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:68) ~[hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.transform.AliasToBeanResultTransformer.transformTuple(AliasToBeanResultTransformer
I saw a post online (http://javatechtricks.blogspot.com/2012/12/hibernate-clob-to-string-conversion.html) about someone saying that Hibernate's result transformer chose not to work with CLOBs due to potential memory issue. But most of the time, my field really isn't going to be that large. Several Kb will be as large as it gets. He specced out a resulttransformer of his own to convert the clobs...but it doesn't work. It gives the error " com.ibm.db2.jcc.a.SqlException: [jcc][10120][11936][4.3.111] Invalid operation: Lob is closed. ERRORCODE=-4470, SQLSTATE=null" everytime i invoke getAsciiStream().
How can I make this work?