-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Informix and CLOB issue
PostPosted: Thu Jun 03, 2010 2:36 am 
Newbie

Joined: Mon May 17, 2010 8:06 pm
Posts: 5
Environment:
Weblogic 10.3.2
JEE5
Hibernate 3.3.0.GA
DB:Informix Dynamic Server, version: 9.30.FC5
Driver:IBM Informix JDBC Driver for IBM Informix Dynamic Server, version: 2.21.JC6

I have an entity docs with a clob column document, and i cannot update this value via entityManager.
Ive tried so many different ways:
database column is clob

Code:
persistence.xml
<persistence-unit name="EbusinessHibernate" transaction-type="JTA">
   <!-- <persistence-unit name="EbusinessHibernate" transaction-type="RESOURCE_LOCAL"> -->
      <provider>org.hibernate.ejb.HibernatePersistence</provider>
      <jta-data-source>EBUS.XA.DATASOURCE</jta-data-source>
      <!-- The <jar-file> element is necessary if you put the persistence.xml in the WAR and the classes in the JAR -->
      <!--
      <jar-file>../../vehicles.jar</jar-file>
      -->
      <properties>
         <property name="hibernate.dialect" value="au.gov.asic.entity.dialect.InformixDialect"/>
         <property name="hibernate.hbm2ddl.auto" value="validate"/>
         <property name="hibernate.show_sql" value="true"/>
         <property name="hibernate.format_sql" value="true"/>
        <!--  <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/> -->
         <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
      </properties>
   </persistence-unit>


First test:
Code:
persistent property
@Column(name = "document", nullable = false)
    @NotNull
    @Basic(fetch=FetchType.LAZY)
    @Lob
    public String getDocument() {
        return this.document;
    }


Exception:
Code:
Caused by: java.sql.SQLException: Type not supported
   at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
   at com.informix.jdbc.IfxValue.a(IfxValue.java:204)
   at com.informix.jdbc.IfxValue.a(IfxValue.java:1108)
   at com.informix.jdbc.IfxPreparedStatement.setCharacterStream(IfxPreparedStatement.java:3576)
   at weblogic.jdbc.wrapper.PreparedStatement.setCharacterStream(PreparedStatement.java:438)
   at au.gov.asic.entity.dialect.StringClobType.nullSafeSet(StringClobType.java:57)
   at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:179)


Second test:
change property value to Clob and use Hibernate utility method to convert string to clob
Code:
@Column(name = "document", nullable = false)
    @NotNull
    public Clob getDocument() {
        return this.document;
    }


Code:
Clob docClob = Hibernate.createClob(doc.toString());
    query.setParameter("doc",docClob );
   Caused by: java.sql.SQLException: Type not supported
   at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
   at com.informix.jdbc.IfxValue.a(IfxValue.java:204)
   at com.informix.jdbc.IfxValue.a(IfxValue.java:1108)
   at com.informix.jdbc.IfxPreparedStatement.setCharacterStream(IfxPreparedStatement.java:3576)
   at weblogic.jdbc.wrapper.PreparedStatement.setCharacterStream(PreparedStatement.java:438)
   at org.hibernate.type.ClobType.set(ClobType.java:70)
   at org.hibernate.type.ClobType.nullSafeSet(ClobType.java:146)
   


Third test:
changed Informix dialect for clob
Code:
registerColumnType(Types.LONGVARCHAR, "clob"); // or TEXT?
      registerColumnType(Types.CLOB, "clob");


Got this from looking at hibernate readme http://www.iiug.org/opensource/
Code:
Caused by: java.sql.SQLException: Type not supported
   at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373)
   at com.informix.jdbc.IfxValue.a(IfxValue.java:204)
   at com.informix.jdbc.IfxValue.a(IfxValue.java:1108)
   at com.informix.jdbc.IfxPreparedStatement.setCharacterStream(IfxPreparedStatement.java:3576)
   at weblogic.jdbc.wrapper.PreparedStatement.setCharacterStream(PreparedStatement.java:438)
   at org.hibernate.type.ClobType.set(ClobType.java:70)
   at org.hibernate.type.ClobType.nullSafeSet(ClobType.java:146)


Ive been testing this for over a day, i think ill just have to revert back to using native sql instead, or does anyone else know how i can resolve this issue?

Thanks,
Shane.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.