commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manuel" <>
Subject [DBUTILS] BeanHandler plus Blob
Date Fri, 15 Oct 2010 07:06:38 GMT

have a class

public class Person {
  private Blob image;
  public void setImage(Blob image) { this.image = image; }
  public Blob getImage() { return image; }

Now I want to load the Person-class with BeanHandler-class
ResultSetHandler<Person> h = new BeanHandler<Person>(Person.class);
Person person = runner.query("select image from ...", h);

Works so far :-) Now what not works:

ObjectInputStream ois = null;
ois = new ObjectInputStream(blob.getBinaryStream());
ImageIcon icon = (ImageIcon) ois.readObject();

-> Exception
You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling
the free() method or after the Blob/Clob's transaction has been committed
or rolled back.

Do the query myself, or and write a own BeanHandler...
But shouldn't there a solution to just say
1.) write blob data in a stream x
2.) write blob data to an object x

OR ... go the other way, means change Person class to have an object let's
say instead Blob and ImageIcon and tell dbutils how to map from blob to

thanks for any response in advance ;)

greetings manuel

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message