-->
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.  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Hibernate evict not working ! crashing my app ! need help !
PostPosted: Thu Nov 13, 2003 12:08 pm 
Newbie

Joined: Thu Nov 13, 2003 11:31 am
Posts: 15
Firstable, I'm doing a read-only operation with hibernate.

guys, not sure if it's been posted or answered already. I've been treading thru the threads and seen quite a few posts regarding sql resultset not being closed(), etc. when working with a large iteration of hibernate results from a session.

well guess what, that's exactly my problem and I need a fix. I tried calling session.evict( [obj] ); where obj is the row object i got from my iterator.next();

where is this going?

I checked the heap with JProbe and not surprisngly, the same object I've been evicting still stays in the memory, refered to by a Hash table in SessionImpl class. Whenever it hits the default JVM 60k memory (which is approximately 60k rows ironically) my app crashes.

Should I go back to my client and tell 'em they need to throw some hardware and increase the java heap size? or can i simply flush these un-used objects?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 12:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Umm I don't believe you.


If you can show some code where

session.evict(o);
assertFalse( session.contains(o) );

fails, and submit it to JIRA, I will take a look.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 12:48 pm 
Newbie

Joined: Thu Nov 13, 2003 11:31 am
Posts: 15
Thank you for your response, sir. I will show some codes.


... //open a session
session.setFlushMode(FlushMode.NEVER);
Iterator myIterator =session.iterate(...);


while (myIterator.hasNext()){
HibernateObject obj = (HibernateObject) myIterator.next();
doQuery( obj ); //do something
session.evict(obj);
obj=null;
}



... //trial here cuz the app crashes during the while loop


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 12:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I really am not going to do anything about this until you submit a convincing test case to JIRA. I have a test case that shows this works. So I don't believe that it doesn't, until I have a test case that shows otherwise.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 12:51 pm 
Newbie

Joined: Thu Nov 13, 2003 11:31 am
Posts: 15
I understand the evict method was added this year? could you tell me what version of hibernate is tested positive according to your test case?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 12:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
We do test-driven-development. So, essentially, every version of Hibernate since the feature was added, I suppose. I run the test suite at least 10 times a day.

Oh, note that evict() would fail if you have a composite-id class that breaks The Rules. (ie. equals()/hashCode()).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 1:11 pm 
Newbie

Joined: Thu Nov 13, 2003 11:31 am
Posts: 15
Thanks.

whats the rule you're referring to? I am using a composite-id class with 3 keys.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 1:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hmm sounds supiciously like you don't implement equals()/hashCode() correctly in your composite-id class, doesn't it. This is required, as per the Hibernate manual.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 2:53 pm 
Newbie

Joined: Thu Nov 13, 2003 11:31 am
Posts: 15
OK Great, so I got another RTFM answer.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 6:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
I think Gavins answer is reasonable and tells you what the problem is. The team does a great job supporting this project. The least people can do is to read the manual (again) and if you don't understand then ask for clarification. Maybe I'm being unreasonable (not enough sleep) but sarcasm is not required, this is a not a paying gig.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 6:45 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ya'grumpy ausies ;)

I took the "I got a RTFM answer again" as a "darn - guyz, I should have read the manual before asking this question, sorry for asking"-answer in disguise ;)

(But if it were not such a disguised question, then joboosc should get a small yelling ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 6:47 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
btw. I still read the manual now and then.....just to be able to answer 85% questions with a confident RTFM ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 13, 2003 8:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
If I was too gumpy then I am sorry. There has been a few unreasonably demanding users that just gets on my nerves when so much effort goes into this project by all involved (and especially Gavin). I to am reading the manual/DTD/etc most days and far from get it right all the time :-(.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 2:40 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
You guys should seriously consider upgrading the documentation. I know you are working on a book, but that's no good for an open-source project - you need excellent online documentation. Think of all the time you would save not answering stupid question from guys like me if the docs were a bit more intuitive.

But I guess your're taking the half-commercial route of JBoss now? Bad online docs -> PROFIT on book!

I know some people say that the Hibernate docs are great. But I find them confusing, non-consistent and unstructured. Stuff like inverse="true" is referred to before beeing explained in the reference docs.

Sorry guys - there's a lot of docs on the site, but they are not good enough (not trying to be flame bait here)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 14, 2003 3:09 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
You are obviously incredibly misinformed about the potential income of computer book authors. Perhaps you should learn something about the publishing industry before trying to tarnish our motives again.

Nick, I'm quite certain that when you start devoting your life to building open source software, that you will expect nothing back from it but insults from users. Actually I think you will make the perfect open source developer, since you never expect anything from anyone else, and just give freely of your own time whenever you see the need.

Now, this bickering is getting absolutely ridiculous. I refuse to let this community degenerate the way some other opensource groups do. We have done very well until just recently and only now have "personality" issues begun to surface. The overwhelming majority of people here are polite and helpful. But we will start to drive these people away if this continues, So, as a pre-emptive strike against further degeneration, lets draw some lines:


The Rules
Rule 1
The people who contribute code to the project and help in other ways by answering questions and writing documentation are allowed, within reason, to be rude from time to time.

Rule 2
Everyone else is expected to be polite at all times. They are also expected to not insult the project team, their motives, or their work. They are, of course, free to not use Hibernate if they so please.

Rule 3
Anyone who does not want to abide by rule 2 is free to become a paying customer at which point they may be as rude and demanding as they like.


If these rules do not help the situation, I will ask Christian to start removing people's forum accounts.

The reason for this is simple practicality. We want to have a forum with a high signal-to-noise ratio, where nice people can get help whenever they need it. It looks like this is the only way to achieve this goal.

peace

Gavin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 20 posts ]  Go to page 1, 2  Next

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.