-->
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: "de-initialize" objects before serialization
PostPosted: Thu Feb 25, 2010 5:29 am 
Newbie

Joined: Sat Sep 12, 2009 12:50 pm
Posts: 6
Hello,

I have a problem with (understanding) serialization of collections.

Guess I have loaded a "Customer" object and want each of his opened trouble tickets. No problem. One-to-Many (one customer, many trouble tickets)
The mapping is bidirectional. So every Customer has a List<TroubleTickets>, every TroubleTicket has a Customer (lazy) object.

I want to only return a List<TroubleTickets> from my method (parameter is a customer).

When it goes to serialization (graniteds) of the List<TroubleTickets>, there is a relatively huge problem:

Since Hibernate knows the lazy-fetched "Customer" of the Trouble-Tickets as initialized, the whole Customer object is serialized for each TroubleTicket.
Since the CustomerObject is about 10 times larger than the Trouble-Ticket, there is more than 10 times unneccessary data than important data.

All trouble-tickets belong to the same customer... So we have 500 times the same customer serialized and transmitted...


Is there any chance to bring the "customer" object back to a lazy loaded, uninitialized reference just before the method ends and serialization starts?


So many thanks.... :)

Steffen


Top
 Profile  
 
 Post subject: Re: "de-initialize" objects before serialization
PostPosted: Thu Feb 25, 2010 6:25 am 
Expert
Expert

Joined: Fri Jan 30, 2009 1:47 am
Posts: 292
Location: Bangalore, India
Hi,

How about making the Customer reference as transient so that serialization will ignore this field.

Regards,
Litty Preeth

_________________
Regards,
Litty Preeth


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.