-->
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.  [ 4 posts ] 
Author Message
 Post subject: Problems with embedded (in process) Derby BLOB data type
PostPosted: Wed Apr 26, 2006 1:53 pm 
Newbie

Joined: Wed Apr 26, 2006 1:44 pm
Posts: 2
Hi,

I am using Hibernate with Hsqldb as embedded (in process) DB engine in my application. I tried to add support for Derby (now derby.apache.org).

It works OK in server/client mode, but it fails in embedded mode with error:

2006.04.26-11:14:42 [http-8080-Processor24] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 20000, SQLState: 22005
2006.04.26-11:14:42 [http-8080-Processor24] ERROR org.hibernate.util.JDBCExceptionReporter - An attempt was made to get a data value of type 'BLOB' from a data value of type 'VARBINARY'.
2006.04.26-11:14:42 [http-8080-Processor24] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session

Note, that I store some Java serialized classes in DB, that is why I use BLOB.

I use Hibernate dialect org.hibernate.dialect.DerbyDialect, JDBC driver org.apache.derby.jdbc.EmbeddedDriver.

I use Hibernate 3.1.

Anybody has some experience or inside for this problem?


Top
 Profile  
 
 Post subject: Re: Problems with embedded (in process) Derby BLOB data type
PostPosted: Thu Mar 15, 2007 9:55 am 
Newbie

Joined: Thu Mar 15, 2007 8:20 am
Posts: 1
lubosp wrote:
Hi,

I am using Hibernate with Hsqldb as embedded (in process) DB engine in my application. I tried to add support for Derby (now derby.apache.org).

It works OK in server/client mode, but it fails in embedded mode with error:

2006.04.26-11:14:42 [http-8080-Processor24] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 20000, SQLState: 22005
2006.04.26-11:14:42 [http-8080-Processor24] ERROR org.hibernate.util.JDBCExceptionReporter - An attempt was made to get a data value of type 'BLOB' from a data value of type 'VARBINARY'.
2006.04.26-11:14:42 [http-8080-Processor24] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session

Note, that I store some Java serialized classes in DB, that is why I use BLOB.

I use Hibernate dialect org.hibernate.dialect.DerbyDialect, JDBC driver org.apache.derby.jdbc.EmbeddedDriver.

I use Hibernate 3.1.

Anybody has some experience or inside for this problem?


Hello all! I'm brand new to hibernate. Sadly I ran into the very same difficulty described above chiefly a problem with serializing BLOBs under Derby embedded. Although its a relatively ancient post, there didn't seem to be any response to this question so after searching the forums, I decided to try to build and debug hibernate in a layman's attempt to charactierize the problem. I think I at least have a clue as to where the problem is occurring although given my lack of experience here I offer my findings up for illumination, not as definitive reasoning.

I have a class that is defined something like:

@Entity
@Table(name="FOO")
public class Foo implements Serializable {

@Id
@Column(name="MyId", length=64)
private String myid;
...

@Column(name="CURRENT_CONFIG", columnDefinition="BLOB")
private MyConfigurationObject config;

etc...
}

What I'm seeing is that if the value of config == null, I wind up in AbstractBynaryType.sqlType which simply does a return Types.VARBINARY. Shortly thereafter I fail with the expection noted in the original post. The what I believe to be relevant, call sequence during the commit is AbstractEntityPersistence.insert() -> AbstractEntityPersistence.dehydrate() (love that name btw) -> which seems to loop through the values and calls NullableType.nullSafeSet() which ultimate makes its way to return the VARBINARY type for a column which has been declared as a BLOB. Indeed, in my test program if I assign a non-null value to config, all is fine.

Given a nearly complete lack of familiarity with some of the subtleties involved here, I thought I would resurrect the thread, offer my observations and see if anyone could offer a solution or some advice on how to work around this as I have to be able to store some null values on BLOB type columns and embedded Derby is pretty much of a requirement.

Thx!

=Ron=


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 23, 2008 1:57 pm 
Newbie

Joined: Thu Oct 23, 2008 1:53 pm
Posts: 1
I'm seeing this problem with embedded Derby as well. If anyone has any tips, it'd be much appreciated.


Top
 Profile  
 
 Post subject: Re: Problems with embedded (in process) Derby BLOB data type
PostPosted: Tue Feb 21, 2012 5:23 am 
Newbie

Joined: Tue Feb 21, 2012 5:22 am
Posts: 1
Adding @Lob annotation should help


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

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.