-->
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.  [ 4 posts ] 
Author Message
 Post subject: How to handle exceptions
PostPosted: Mon Apr 07, 2008 5:32 pm 
Newbie

Joined: Mon Jan 21, 2008 4:59 pm
Posts: 10
Location: Ecuador
Hi,

I'm using next code on my DAO, when I force a broke accessing DB, my JSP shows no errors and Hibernate won't says nothing. I don't know why my 'catch (Exception e)' doesn't work.

try {
session.beginTransaction();
Query query = session.createQuery("FROM Articulos WHERE cod = " + iCodArt);
result = query.list();
sessionFactory.close();
}
catch (Exception e) {
StringWriter wr = new StringWriter();
e.printStackTrace(new PrintWriter(wr));
}

Thank you for your help.

Hibernate version: 3
Name and version of the database you are using: Oracle XE 10


Top
 Profile  
 
 Post subject: Re: How to handle exceptions
PostPosted: Mon Apr 07, 2008 5:35 pm 
Expert
Expert

Joined: Wed Apr 11, 2007 11:39 am
Posts: 735
Location: Montreal, QC
Because you are writing the exception stack trace into a StringWriter which is left there. You need to print the stack trace somewhere visible.



Farzad-


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 12:21 am 
Newbie

Joined: Wed Mar 28, 2007 1:05 am
Posts: 8
Thats right just do e.printStackTrace() or use logger to log the exception


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Tue Apr 08, 2008 10:21 am 
Newbie

Joined: Mon Jan 21, 2008 4:59 pm
Posts: 10
Location: Ecuador
Ok, don't even heard about 'logger' (I'm a beginner) but I'll find something. Thank you.


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