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.  [ 7 posts ] 
Author Message
 Post subject: Very large object returned: How to compress
PostPosted: Tue Aug 10, 2004 8:42 pm 
Newbie

Joined: Wed Aug 04, 2004 8:55 pm
Posts: 6
This may be more of a j2ee question than a Hibernate question, but I have a method (listed below) that returns a very large object that has hundreds of child objects creating a large object of 10-15 mb that is returned of the network through a ejb remote call. Unfortunately, Lazy initialization is not an option for me. Could anyone help me figure out how to compress this object prior to returning it over the network.

Thanks,
Rutherford

Hibernate version: 2.1.3

Code between sessionFactory.openSession() and session.close():

public Trial openTrial(Long trial_id) throws HibernateException {
Trial trial = null;
Session session = sessionFactory.openSession();

try {
trial = (Trial)session.load(Trial.class, trial_id);

} catch (HibernateException he) {
throw he;

} finally {
session.close();
}
return trial;
}



Database: Oracle 8i


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 8:53 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
THAT IS ONE BIG OBJECT! What the heck do you have in there? Can you pos the class definition?

_________________
Matt Veitas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 9:55 pm 
Newbie

Joined: Wed Aug 04, 2004 8:55 pm
Posts: 6
You ain't kiddin'! Its HUGE! Luckily the vast majority of the objects are much smaller (1-4mbs) but those are still pretty big. I can't post the class definition, but it is an hierarchical object model with several many-to-many and many-to-one collection relationships throughout the object tree (a Trial).

The problem started with converting (legacy) XML representation of a Trial that was stored in as a string in a single Long Oracle field into a series of relational tables using Hibernate. The original XML size goes up to 40MB in size.

I still may be able to use lazy initialization to improve performance, but I looking for options to compress the returm object using a stateless bean.

I should also add I using a swing based client talking to JBoss EJBs. So I close the hibernate session when the remote method returns. I know there is a way to re-attach the object instance to a new hibernate session to retrieve any lazy objects, but I was always getting lazyInitializationExceptions at unsual times.

Any help compressing this object would be great!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 10, 2004 10:06 pm 
Regular
Regular

Joined: Mon Feb 23, 2004 10:42 pm
Posts: 102
Location: Washington DC
I am going to ask....is there a need to bring back all 40MB of the data at once.

Doing the lazy instantiation is definately the way to go. I have not had the chance to play with that 100% yet, but it does work, otherwise Gavin and company wouldn't recommend it. I would recommend that you create a simple application and try and get the lazyiness working that way without the EJB. Good luck!

If you do find your solution, the community would love for you to add to the wiki about your extreme case I am sure.

_________________
Matt Veitas


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 3:36 am 
Newbie

Joined: Wed Aug 04, 2004 8:55 pm
Posts: 6
Returning the entire object is not necesarily needed, but we have existing chunks o' code that perform cascading sorts and other re-ordering of collections that need to access the entire object tree to perform their function. (a lot of of .contains() and .equals())

When I tried o set a series of collection as lazy, I could not figure out all the places where I needed to locate the code to fetch the associated objects. I would get errors in most cases because a object is being re-ordered based on some rules and not all the objects in the collection are initialized for it to compare itself to.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 11, 2004 3:48 am 
Newbie

Joined: Wed Aug 04, 2004 8:55 pm
Posts: 6
When I do figure this out, I will gladly post my experience.


Top
 Profile  
 
 Post subject: Re: Very large object returned: How to compress
PostPosted: Wed Aug 11, 2004 4:29 am 
Beginner
Beginner

Joined: Thu Apr 29, 2004 4:03 pm
Posts: 40
rutherford wrote:
This may be more of a j2ee question than a Hibernate question, but I have a method (listed below) that returns a very large object that has hundreds of child objects creating a large object of 10-15 mb that is returned of the network through a ejb remote call. Unfortunately, Lazy initialization is not an option for me. Could anyone help me figure out how to compress this object prior to returning it over the network.

Thanks,
Rutherford

Hibernate version: 2.1.3

Code between sessionFactory.openSession() and session.close():

public Trial openTrial(Long trial_id) throws HibernateException {
Trial trial = null;
Session session = sessionFactory.openSession();

try {
trial = (Trial)session.load(Trial.class, trial_id);

} catch (HibernateException he) {
throw he;

} finally {
session.close();
}
return trial;
}



Database: Oracle 8i


try to create a new implementation of the serializable method. I don't know how exactly, try to look around marshalling/demarshalling api, compression algorithms , etc...


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