• Post Reply Bookmark Topic Watch Topic
  • New Topic

how hibernate stores object in a blob  RSS feed

sonalika kulkarni
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my case Object is getting saved in a blob format but while we try to read and save that blob in a file it is not getting read giving EOFException and available() method of ObjectInputStream shows 0 that means there is nothing to be read . Then I checked in DB there was data in a blob format.
Can anyone help in in understanding that how hibernate stores an object in a blob format. What I analyzed is it is adding some special character while saving object in DB so that not able to convert byte to object format, as it is giving EOFException . The code I am writting is

ByteArrayInputStream bais;
ObjectInputStream in;
try {
bais = new ByteArrayInputStream(rcmCommunicationBean1);
in = new ObjectInputStream(bais);
ObjectStreamClass myObject = ObjectStreamClass.lookup(
Object obj = new Object();
while ((obj = in.readObject()) != null) {
if (obj instanceof RCMCommunicationBean) {
rcmCommunicationBean = (RCMCommunicationBean)obj;
} catch (IOException ex) {
} catch (ClassNotFoundException ex) {
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!