-->
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: disconnect object from hibernate session / get clean object
PostPosted: Wed Jan 10, 2007 7:56 am 
Newbie

Joined: Wed Jan 10, 2007 7:49 am
Posts: 4
hi everybody!

following problem...

use hibernate to get object from database. then i serialize object to bytearray > send via webservice to client > client deserialize.
now my problem appears. to deserialize a class called org.hibernate.proxy.pojo.cglib.SerializableProxy is need.

problem is that, the object which i serialized includes already some hibernate informations. i know that this is need if object is later attached to a session, so hibernate must be able to identifiy object.....
but i want to get POJO without any hibernate stuff.

is there an export method or anything else?

googled many many times. but could not found anything.

hope you could help me .. it is very very important.

thx


Top
 Profile  
 
 Post subject: Fetch or set to null
PostPosted: Wed Jan 10, 2007 11:01 am 
Regular
Regular

Joined: Wed Aug 24, 2005 11:49 am
Posts: 63
You can fetch many-to-ones in your query (left join fetch ....)
or set the value to 'null' if you don't want a proxy (and no value)

_________________
Edwin van der Elst
Finalist IT Group


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 11, 2007 3:20 am 
Newbie

Joined: Wed Jan 10, 2007 7:49 am
Posts: 4
thank you very much, evdelst.

found chapter in doc at http://www.hibernate.org/hib_docs/v3/reference/en/html/mapping.html
which is very important. because setting lazy to false at all many-to-one elements eleminate the problem.


Top
 Profile  
 
 Post subject: Maybe
PostPosted: Thu Jan 11, 2007 8:03 am 
Regular
Regular

Joined: Wed Aug 24, 2005 11:49 am
Posts: 63
That will work, but it can be very bad for performance to set lazy to false.
A better solution is to fetch in the query when needed, so you can use lazy-loading in other parts of your application.

_________________
Edwin van der Elst
Finalist IT Group


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.