I'm currently trying a simple insert/retrieve of a row contaning a Blob (long raw). It looks like that:
Code:
Tt tt2 = new Tt();
tt2.setCarte((Blob)Hibernate.createBlob(new FileInputStream("e:\\Z.GIF")));
session.save(tt2);
session.flush();
session.connection().commit();
session.close();
Session session2 = sf.openSession();
// Retrieve the record: notice the space padding ...
Tt tt3 = (Tt)session2.get(Tt.class, "joe ", LockMode.UPGRADE);
The insert part, i guess, works allright except i can't tell what's inside the long raw column.
On 'get' (or 'load') i had this exception:
Code:
13:48:07,695 WARN JDBCExceptionReporter:38 - SQL Error: 17004, SQLState: null
13:48:07,695 ERROR JDBCExceptionReporter:46 - Invalid column type
13:48:07,705 WARN JDBCExceptionReporter:38 - SQL Error: 17004, SQLState: null
13:48:07,705 ERROR JDBCExceptionReporter:46 - Invalid column type
13:48:07,705 ERROR JDBCExceptionReporter:38 - could not load: [test.Tt#joe ]
java.sql.SQLException: Invalid column type
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:219)
at oracle.jdbc.driver.OracleStatement.getBLOBValue(OracleStatement.java:2822)
at oracle.jdbc.driver.OracleResultSetImpl.getBLOB(OracleResultSetImpl.java:458)
at oracle.jdbc.driver.OracleResultSetImpl.getBlob(OracleResultSetImpl.java:511)
at oracle.jdbc.driver.OracleResultSet.getBlob(OracleResultSet.java:1703)
at net.sf.hibernate.type.BlobType.get(BlobType.java:32)
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:66)
at net.sf.hibernate.loader.Loader.hydrate(Loader.java:611)
at net.sf.hibernate.loader.Loader.loadFromResultSet(Loader.java:552)
at net.sf.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:511)
at net.sf.hibernate.loader.Loader.getRow(Loader.java:426)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:209)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:831)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:851)
at net.sf.hibernate.loader.SimpleEntityLoader.load(SimpleEntityLoader.java:58)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2081)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2004)
at net.sf.hibernate.impl.SessionImpl.get(SessionImpl.java:2029)
at test.Main.main(Main.java:78)
I use Hibernate 2.1.2 on Oracle 8.16
I've tried many things and searched the forum and wiki but this is the best i can get.
Some advice ?
Oh, and by the way, is there a chance taht could work on both Oracle 8i and DB2 7.2 ?
Thanks a lot.
Paulo.