-->
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.  [ 3 posts ] 
Author Message
 Post subject: Exception Problems
PostPosted: Fri Feb 17, 2006 11:14 am 
Newbie

Joined: Fri Feb 17, 2006 11:05 am
Posts: 3
I have a interesting question. does hibernate doesnt throw an excption if it builds the factory?

because if i debug this code


Code:
try {   
            conf.configure().addProperties(prop);
            factory=conf.buildSessionFactory();
        }catch(HibernateException e)
        {
            throw new Exception( "NamingException: " + e.getMessage( ));
        }

and type in my dialog false data for example a false ip of the server the output says unknownhostexcception what is right but why isnt this exception caught in thes catch ? it is the same if i type false login informations.

because i wanto to open a JOptionPane if i get an unknown host exception or anythink like that

and i have also tried UnknownHostException instead of HibernateException.

please give me a fast and compident answer

With best regards
Joe
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 1:03 pm 
Regular
Regular

Joined: Wed Feb 08, 2006 3:59 pm
Posts: 75
Hibernate won't open a connection until needed, and it doesn't need one to build the SessionFactory. You can add a dummy query to your code to check that login/pwd/host etc. are ok


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 17, 2006 2:50 pm 
Newbie

Joined: Fri Feb 17, 2006 11:05 am
Posts: 3
thats not the truth because if the program reachs the point where the factory is created the unkownhostexception occures.
but the real question is how can i catch the unknownhostexception that i can create a message for the user


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