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: can't get rid of Exception message
PostPosted: Mon Jun 30, 2008 6:34 am 
Newbie

Joined: Wed Jun 11, 2008 6:36 am
Posts: 10
Hi, i have the following part of code that works fine, however i keep getting an exception message printed on the console i don't know why, here is the piece of code.

try{
myObject.getCollection().remove(aCollectionObject); ... (excepiton line)
}catch(Exception e){

myObject = myObjectDAO.getObjectCollectionsEagerly(myObject.getId());
myObject .getCollection().remove(aCollectionObject);
}


note that i don't want to change the way of working of the program, and it works 100% fine except that i get the fuckin exception message even if i have a try catch, and the message points exactly to to the line (exception line).

i tried to change Exception to RuntimeException but no change.

any suggestion. ... note that i can't load the object eagerly from the begining i have a situation where the first part in the try code works fine.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 30, 2008 8:48 am 
Beginner
Beginner

Joined: Wed Nov 08, 2006 8:24 am
Posts: 26
Location: Gothenburg, Sweden
What kind of exception do you get?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 30, 2008 8:51 am 
Newbie

Joined: Wed Jun 11, 2008 6:36 am
Posts: 10
org.hibernate.LazyInitializationException

i get it because the collection is loaded lazily and thats exactly what i want, however when i get this exception, i execute the code in the catch block.

but i don't want to have the stack trace of the exception in my log


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 30, 2008 8:57 am 
Beginner
Beginner

Joined: Wed Nov 08, 2006 8:24 am
Posts: 26
Location: Gothenburg, Sweden
I don't think you can select which exceptions are written to the log, and which are not.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 30, 2008 8:59 am 
Newbie

Joined: Wed Jun 11, 2008 6:36 am
Posts: 10
yes but since the exception is inside try catch block and since the exception happens in the try block i think that there should not be any logging for the stack trace since i am catching the exception... unless as i think there is some printstacktrace(); in the API of hibernate ... !!!


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.