Barry Nauta - 2006-06-26

Hi,

I had to take over a project written by someone else and stumble into a few problems. The application is a web front-end to a db using jtds and Hibernate.

I receive the following error message:
Unable to convert between java.lang.Integer and BINARY.

I let HIbernate print the queries it executes and when I perform this query manually, I receive data. My guess is that there is some mapping problem ;-), but I cannot figure out whether this is hibernate of jtds related.

Any input is much appreciated.

Here is my stacktrace:

net.sf.hibernate.exception.GenericJDBCException: Unable to perform find at net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:80) at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4131)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3663)
at net.sf.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:238)
at be.switchsoft.hg.service.provider.AdviceSearchProvider.process(AdviceSearchProvider.java:99) at be.switchsoft.hg.service.ServiceBroker.process(ServiceBroker.java:137)
at be.switchsoft.hg.struts.action.ListAdvicesAction.execute(ListAdvicesAction.java:98) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: Unable to convert between java.lang.Integer and BINARY. at net.sourceforge.jtds.jdbc.Support.convert(Support.java:565)
at net.sourceforge.jtds.jdbc.JtdsResultSet.getBytes(JtdsResultSet.java:729) at net.sourceforge.jtds.jdbc.JtdsResultSet.getBytes(JtdsResultSet.java:1000)
at net.sf.hibernate.type.BinaryType.get(BinaryType.java:63)
at net.sf.hibernate.type.SerializableType.get(SerializableType.java:33)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:53)
at net.sf.hibernate.type.AbstractType.hydrate(AbstractType.java:67)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:690)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:631)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:590)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:505)
at net.sf.hibernate.loader.Loader.getRowFromResultSet(Loader.java:218)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:285)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
at net.sf.hibernate.loader.CriteriaLoader.list(CriteriaLoader.java:118)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:3660)
... 25 more

Additionally, here is my hibernate config file for advices:

<hibernate-mapping auto-import="false">
<class name="be.switchsoft.hg.persistence.Advice"
table="tb_hg_advice">

    &lt;id name=&quot;adviceID&quot; type=&quot;java.lang.Long&quot;
        column=&quot;pk_hg_advice&quot;&gt;
        &lt;generator class=&quot;native&quot; /&gt;
    &lt;/id&gt;

    &lt;property name=&quot;requestDate&quot; type=&quot;date&quot; column=&quot;requestdate&quot;
        not-null=&quot;true&quot; /&gt;

    &lt;property name=&quot;newMsdsInfo&quot; type=&quot;java.lang.String&quot;
        column=&quot;newmsdsinfo&quot; not-null=&quot;false&quot; length=&quot;255&quot;/&gt;

    &lt;property name=&quot;avgUsage&quot; type=&quot;java.lang.Integer&quot; column=&quot;avgusage&quot;
        not-null=&quot;true&quot; /&gt;

    &lt;property name=&quot;maxStorage&quot; type=&quot;java.lang.Integer&quot; column=&quot;maxstorage&quot;
        not-null=&quot;true&quot; /&gt;

    &lt;property name=&quot;packaging&quot; type=&quot;text&quot;
        column=&quot;packaging&quot; not-null=&quot;true&quot;/&gt;

    &lt;property name=&quot;commentRequester&quot; type=&quot;text&quot;
        column=&quot;commentrequester&quot; not-null=&quot;false&quot;/&gt;

    &lt;property name=&quot;commentApprover&quot; type=&quot;text&quot;
        column=&quot;commentapprover&quot; not-null=&quot;false&quot;/&gt;

    &lt;property name=&quot;checkHS&quot;
        type=&quot;be.switchsoft.hg.persistence.helper.Progress&quot; column=&quot;checkhs&quot;
        not-null=&quot;true&quot; /&gt;

    &lt;property name=&quot;checkFES&quot;
        type=&quot;be.switchsoft.hg.persistence.helper.Progress&quot; column=&quot;checkfes&quot;
        not-null=&quot;true&quot; /&gt;

    &lt;property name=&quot;checkENV&quot;
        type=&quot;be.switchsoft.hg.persistence.helper.Progress&quot; column=&quot;checkenv&quot;
        not-null=&quot;true&quot; /&gt;

    &lt;property name=&quot;approvalDate&quot; type=&quot;date&quot; column=&quot;approvaldate&quot;
        not-null=&quot;false&quot; /&gt;

    &lt;property name=&quot;inStockDate&quot; type=&quot;date&quot; column=&quot;instockdate&quot;
        not-null=&quot;false&quot; /&gt;

    &lt;property name=&quot;outStockDate&quot; type=&quot;date&quot; column=&quot;outstockdate&quot;
        not-null=&quot;false&quot; /&gt;

    &lt;property name=&quot;locationDescription&quot; type=&quot;java.lang.String&quot;
        column=&quot;locationdescription&quot; not-null=&quot;false&quot; length=&quot;255&quot; /&gt;

    &lt;property name=&quot;purposeDetail&quot; type=&quot;java.lang.String&quot;
        column=&quot;purposedetail&quot; not-null=&quot;false&quot; length=&quot;255&quot; /&gt;

    &lt;many-to-one name=&quot;role&quot; class=&quot;be.switchsoft.hg.persistence.Group&quot;
        column=&quot;fk_hg_role&quot; not-null=&quot;true&quot;/&gt;

    &lt;property name=&quot;closeExtend&quot;
        type=&quot;be.switchsoft.hg.persistence.helper.Extended&quot;
        column=&quot;closeextend&quot; not-null=&quot;true&quot; /&gt;

    &lt;property name=&quot;closeExtendDate&quot; type=&quot;date&quot;
        column=&quot;closeextenddate&quot; not-null=&quot;false&quot; /&gt;

    &lt;many-to-one name=&quot;hazardousGood&quot; column=&quot;fk_hg_hazardousgoodid&quot;
        class=&quot;be.switchsoft.hg.persistence.HazardousGood&quot;
        cascade=&quot;none&quot; /&gt;

    &lt;many-to-one name=&quot;supplier&quot; column=&quot;fk_hg_supplierid&quot;
        class=&quot;be.switchsoft.hg.persistence.Supplier&quot; cascade=&quot;none&quot; /&gt;

    &lt;many-to-one name=&quot;location&quot; column=&quot;fk_hg_locationid&quot;
        class=&quot;be.switchsoft.hg.persistence.Location&quot; cascade=&quot;save-update&quot; /&gt;

    &lt;list name=&quot;contacts&quot; inverse=&quot;false&quot; cascade=&quot;all&quot;&gt;
        &lt;key column=&quot;fk_hg_advice&quot;/&gt;
        &lt;index column=&quot;nr&quot;/&gt;
        &lt;one-to-many class=&quot;be.switchsoft.hg.persistence.Contact&quot;/&gt;
    &lt;/list&gt;

    &lt;many-to-one name=&quot;department&quot; column=&quot;fk_hg_departmentid&quot;
        class=&quot;be.switchsoft.hg.persistence.Department&quot;
        cascade=&quot;save-update&quot; /&gt;

    &lt;many-to-one name=&quot;purpose&quot; column=&quot;fk_hg_purposeid&quot;
        class=&quot;be.switchsoft.hg.persistence.Purpose&quot; cascade=&quot;none&quot; /&gt;

&lt;/class&gt;

</hibernate-mapping>

Thanks!!!