-->
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.  [ 2 posts ] 
Author Message
 Post subject: bytecode instrumentation and serialization - serious error?
PostPosted: Sun May 17, 2009 2:29 pm 
Newbie

Joined: Thu Feb 28, 2008 4:39 am
Posts: 4
I have a table with field byte[] annotated with @Lob = Blob field.
This field holds attachments and documentation says that by default it's lazy, so there were no problem with such organization (now I know it's best to have table dedicated for blob).
So this field is lazy, but (as i've read) only in Postgres... Oracle doesn't implement lazy for blob fields.
So i've read about bytecode instrumentation, i've done ant task and ok - my blob's are lazy.
But... my attachments sometimes is getting lost! WTF?
Debugging have got an answer: serialization. If blob field is lazy and not loaded, it's null at serialization time and it serializes null. When deserialized, it's still null and hibernate probably is loosing information that it's null because of lazy. So Hibernate see that entity has changed, and with the nearest select it automatically persist it and override blob field with null value.
I've tried to lazy load blob field just before serialization, but sometimes entity is disconnected from entity manager and it doesn't work.
For now I have an ugly hack: in entity at deserialization time I lookup entity manager via JNDI, find blob field from database and set it manually.
Please tell mi how should it work.
Because as I see it know it's very serious error which can cause louse of data.


Top
 Profile  
 
 Post subject: Re: bytecode instrumentation and serialization - serious error?
PostPosted: Fri May 22, 2009 7:47 am 
Newbie

Joined: Thu Feb 28, 2008 4:39 am
Posts: 4
It seems that FieldInterceptor responsible for field lazy loading is lost during passivation. Is there any way to recreate it?


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