-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate/JPA ohne Datenbankverbindung wirft keine Exception
PostPosted: Tue Oct 28, 2008 4:59 pm 
Newbie

Joined: Sat Oct 25, 2008 2:09 pm
Posts: 6
Hallo,
wie kann man mit Hibernate/JPA (Hibernate 3.4 und EntityManager 3.4) abfangen, ob die Datenbankverbindung besteht oder nicht?

Mit dem folgenden Code gelingt es mir nicht in den Catch Block zu gelangen. Dies scheint nicht zu interessieren.

Code:
try {
  EntityManagerFactory emf = Persistence.createEntityManagerFactory("my_database", null);
  EntityManager entityManager = emf.createEntityManager();
} catch (Throwable t) {
  // I want to go here if something goes wrong...
  System.out.println("** Error: " + t.getMessage());
}



Ich möchte im Vorfeld feststellen ob die Verbindung besteht oder nicht. Leider habe ich hierzu in der Dokumentation dazu nichts finden können...

Bin dankbar für alles Tips!
Danke.
Paul


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.