Beginner |
 |
Joined: Thu Jul 22, 2004 8:09 am Posts: 20
|
I am getting this error when I try to do a refresh.
Hibernate version:
2.1.6
Mapping documents:
<class
name="com.xxx.bean.Email"
table="EMAILS"
>
<composite-id>
<key-property
name="emailId"
column="EMAIL_ID"
type="java.lang.Long"
length="22"
/>
<key-property
name="emailattachment"
column="EMAILATTACHMENT"
type="java.sql.Blob"
/>
</composite-id>
<!-- Associations -->
<!-- derived association(s) for compound key -->
<!-- end of derived association(s) -->
</class>
Code between sessionFactory.openSession() and session.close():
byte[] buffer = new byte[1];
buffer[0] = 1;
email.setEmailattachment(Hibernate.createBlob(buffer));
getHibernateTemplate.save(email);
getHibernateTemplate().refresh(email, LockMode.UPGRADE); // error happens here..
Is this something to do with the datatype defined in the database?
Any help is appreciated.
Full stack trace of any exception that occurs:
org.springframework.jdbc.BadSqlGrammarException: Bad SQL grammar [] in task 'Hibernate operation'; nested exception is java.sql.SQLException: ORA-00932: inconsistent datatypes
java.sql.SQLException: ORA-00932: inconsistent datatypes
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:830)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:527)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:91)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:911)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:931)
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.refresh(SessionImpl.java:2183)
at org.springframework.orm.hibernate.HibernateTemplate$7.doInHibernate(HibernateTemplate.java:259)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:176)
at org.springframework.orm.hibernate.HibernateTemplate.refresh(HibernateTemplate.java:257)
at com.csc.exes.dao.hibernate.EmailDAOHibernateImpl.save(EmailDAOHibernateImpl.java:80)
at com.csc.exes.dao.hibernate.EmailDAOHibernateImplTest.testSave(EmailDAOHibernateImplTest.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Name and version of the database you are using:
Oracle 9i
Debug level Hibernate log excerpt:
|
|