Hello,
I got the problem that I'm not able to load a previous stored record from the DB (Postgres 7.4.2 in my case).
Storing the blob works fine, but if I try to load everything screws up. I get a illegal format of Integer while loading the blob.
Here's the code snipplet and the mapping:
Hibernate Version: 2.1.3
Mapping:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class
name="Attachment"
table="attachment"
schema="public"
proxy="Attachment"
>
<id
name="attachmentId"
type="java.lang.Integer"
column="attachment_id"
>
<generator class="sequence">
<param name="sequence">attachment_attachment_id_seq</param>
</generator>
</id>
<property
name="description"
type="java.lang.String"
column="description"
not-null="true"
length="255"
/>
<property
name="data"
type="java.sql.Blob"
column="data"
not-null="true"
length="255"
/>
<!-- associations -->
<!-- bi-directional many-to-one association to Comment -->
<many-to-one
name="comment"
class="Comment"
not-null="true"
>
<column name="comment_id" />
</many-to-one>
</class>
</hibernate-mapping>
Code between opening and closing the session:
List ret = sess.find("from Attachment as attachment where attachment.comment.commentId = " + commentId);
Stacktrace:
15:23:39,046 INFO [STDOUT] Hibernate: select attachment0_.attachment_id as attachme1_, attachment0_.description as descript2_, attachment0_.data as data, attachment0_.comment_id as comment_id from public.attachment attachment0_ where (attachment0_.comment_id=31 )
15:23:39,125 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 22003
15:23:39,125 ERROR [JDBCExceptionReporter] Ung