-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to catch HibernateException
PostPosted: Tue Aug 02, 2011 5:38 am 
Newbie

Joined: Mon Jun 06, 2011 2:44 am
Posts: 4
Hi team,
It is very simple question, but I can't find, how to catch HibernateException.
I just want do Exception Handling in my code, I wrote,

SessionFactory sessionFactory = new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();

in my code and configure method throws HibernateException, so in try/catch block I catch HibernateException.

To test this, I just delete my Database and run the code, it was not catch in catch block, and it gives me exception,
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException.

Please help me.


Top
 Profile  
 
 Post subject: Re: How to catch HibernateException
PostPosted: Wed Aug 03, 2011 9:56 am 
Newbie

Joined: Tue Jun 07, 2011 8:09 am
Posts: 2
It looks like it's a MySQLSyntaxErrorException that gets thrown, not a HibernateException. If you want to catch it, you'll have to specify it in your catch.


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