-->
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.  [ 3 posts ] 
Author Message
 Post subject: Blob, byte[], Postgre and MySQL
PostPosted: Mon Nov 21, 2005 9:29 pm 
Newbie

Joined: Mon Nov 21, 2005 9:10 pm
Posts: 2
Hibernate version: 3.0.5

Code between sessionFactory.openSession() and session.close():
session.save(video);

Full stack trace of any exception that occurs:
Code:
Exception in thread "main" java.lang.UnsupportedOperationException: Blob may not
be manipulated from creating session
        at org.hibernate.lob.BlobImpl.excep(BlobImpl.java:104)
        at org.hibernate.lob.BlobImpl.getBytes(BlobImpl.java:50)
        at org.hibernate.lob.SerializableBlob.getBytes(SerializableBlob.java:35)

        at com.mysql.jdbc.PreparedStatement.setBlob(PreparedStatement.java:305)
        at fapesp.hibernate.BinaryBlobType.nullSafeSet(BinaryBlobType.java:39)
        at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:141)
        at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEn
tityPersister.java:1617)
        at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEn
tityPersister.java:1594)
        at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntit
yPersister.java:1850)
        at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntit
yPersister.java:2200)
        at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.ja
va:46)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)

        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)

        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutio
ns(AbstractFlushingEventListener.java:274)
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlus
hEventListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
        at fapesp.hibernate.InserirVideo.inserirPuroHibernate(Unknown Source)
        at fapesp.hibernate.InserirVideo.main(Unknown Source)


Name and version of the database you are using:
PostgreSQL 8.1, MySQL 4.1

Hello, guys, well, I'm having some troubles on inserting video files in some databases...

I know you all think that this forum has enough questions about blobs, but here am I with another one :)

Well, I've inserted a video (40mb) to a PostgreSQL database, using "oid" sql-type and BinaryBlobType ( http://www.hibernate.org/73.html ). It took 19 seconds.

The same operation (mapping sql-type to longblob) in a MySQL database throws the exception above.

Reading the forums, I found that mapping the type to binary would work, and did. But the same insert video operation now takes 60 seconds using binary instead of BinaryBlobType!

I don't know how blobs are manipulated, I just know that they're pointers to anywhere-I-don't-know-where, instead of long arrays of bytes. maybe this difference is the reason to the lost of performance.

So.. what this exception means? Why this exception is thrown just when using MySQL?
Anywhere could explain me?

Thanks, and sorry for any English errors, I'm still learning... :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 21, 2005 9:32 pm 
Newbie

Joined: Mon Nov 21, 2005 9:10 pm
Posts: 2
sorry.. anyone could explain me, not anywhere hehe...
I didn't find any 'edit' button..

Sorry, Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 7:07 am 
Newbie

Joined: Wed Dec 14, 2005 6:50 am
Posts: 17
I'm not sure about the database diffrence but
as u can see out of the sourcecode (BlobImpl), every method do nothing but:
Code:
throw new UnsupportedOperationException("Blob may not be manipulated from creating session");

The only to methods who are implemented really, are:
    Code:
    getBinaryStream()

    Code:
    length()


So use those instead of getBytes()

Why they used the text "Blob may not be manipulated" i can't say...
Maybe anybody can help us with that?

Greets


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.