-->
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.  [ 5 posts ] 
Author Message
 Post subject: Leal memory in query.list()
PostPosted: Wed Jul 29, 2009 12:13 pm 
Newbie

Joined: Wed Jul 29, 2009 12:02 pm
Posts: 11
Hello everybody,

I am developing a application using hibernate 3.1, and my OldGen memory in the JVM is inscreasing till the system gets collapsed.

I have found that the problem is relared to Lists in Hibernate ( query.list(); ).

Any of you know how can I find out a solution to the problem ?

This is my code :

---------------------------------------------------------------------------------
session = sessionFactory.openSession();
String sQuery = "FROM channel WHERE 1=1 AND ITVPLAT_FK ="+itvplat_fk+" AND CHANNELFUNCTIONALID='"+channelfid+"'";
java.sql.Timestamp timestamp = getCurrentJavaSqlTimestamp();
sQuery+=" AND VALIDFROM <= '" + timestamp + "' AND '" + timestamp + "' <= VALIDTO";
Query query = session.createQuery(sQuery);

List<channel> result = query.list();

session.clear();
session.close();
-----------------------------------------------------------------------------------


Top
 Profile  
 
 Post subject: Re: Leal memory in query.list()
PostPosted: Wed Jul 29, 2009 5:13 pm 
Beginner
Beginner

Joined: Wed Jul 29, 2009 3:43 pm
Posts: 22
How many associations does your channel object have? Are they configured to be loaded lazily or eagerly?
Have you considered pagination?


Top
 Profile  
 
 Post subject: Re: Leal memory in query.list()
PostPosted: Thu Jul 30, 2009 3:26 am 
Newbie

Joined: Wed Jul 29, 2009 12:02 pm
Posts: 11
This is my object channel !!!

public class channel implements java.io.Serializable {


// Fields

private static final long serialVersionUID = -1707963982593947373L;
private Long id;
private Iatrigger iatrigger;
private Itvplat itvplat;
private String channelfunctionalid;
private Date validfrom;
private Date validto;

Where iatrigger and itvplat are other objects !!!

This is the association you mean ?

About lazy or eagerly?

Can you tell me more details please ?

Thanks !


Top
 Profile  
 
 Post subject: Re: Leal memory in query.list()
PostPosted: Thu Jul 30, 2009 4:46 am 
Beginner
Beginner

Joined: Wed Jul 29, 2009 3:43 pm
Posts: 22
You can configure your associations to be loaded lazily i.e. they will be loaded only when they are accessed. Example

Example:

class A{
B b;
}

class B{
C c;
}

***********************************************
something like this in mapping for class A

<set name="b" cascade="save-update" lazy="true">.
************************************************


*************************************************
something like this in mapping for class B
<set name="c" cascade="save-update" lazy="true">.
*************************************************


Top
 Profile  
 
 Post subject: Re: Leal memory in query.list()
PostPosted: Thu Jul 30, 2009 7:26 am 
Newbie

Joined: Wed Jul 29, 2009 12:02 pm
Posts: 11
The fact that I donĀ“t use lazily, can be the cause of I have such a big consunption of memory in my application ?


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