createEntityManagerFactory « Exception « JPA Q&A





1. No Exception from Persistence.createEntityManagerFactory(..)    forum.hibernate.org

Hi! I'm using JPA with Hibernate. Calling Persistence.createEntityManagerFactory(..) succeeds even though the data source is not available, i.e. my database is down. The method does not throw any exceptions and it doesn't even return null. Is this correct behavior? How can I detect the failure? Thank you in advance for any hints!

2. exception in HibernatePersistence.createEntityManagerFactory    forum.hibernate.org

Does anyone know how to force HibernatePersistence.createEntityManagerFactory to return a null if it cannot find the requested persistence-unit? I have an application where I have multiple persistence providers on my classpath (toplink and hibernate). In my persistence.xml I have a single persistence-unit specifying a toplink provider. When I call javax.persistence.Persistence.createEntityManagerFactory() with my persistence-unit, I get the following HibernateException: "Hibernate Dialect must ...

3. createEntityManagerFactory throwing NullPointerException    forum.hibernate.org

post: createEntityManagerFactory throwing NullPointerException when used with SQL Server hibernate version: 3.2.2 database: SQL Server 2005 web server: Apache Tomcat/6.0.13 IDE: netbeans I'm working on an internal web-app that connects to a SQL Server 2005 back-end. Everything was basically moving along smoothly until I got an error trying to create an EntityManagerFactory with the following line: Code: emf = Persistence.createEntityManagerFactory("foo"); Originally ...

4. Catch an Exception when calling createEntityManagerFactory?    forum.hibernate.org

Basically I am not able to catch an Exception in case the database is not available and I am calling Persistence.createEntityManagerFactory(...); Any ideas how to catch the exception? This is a StackTrace that is thrown, but the my catch block is not reached: Code: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up. ...

5. JPA / Hibernate handle error in createEntityManagerFactory a    forum.hibernate.org

Hi, I wonder how I can capture a possible exception using JPA, when creating a new instance with EntityManagerFactory? I'm working with Hibernate 3.3.1 and Entitymanager 3.4.0. For example, if the database is not reachable or so, I would take exception, however I have managed to do so. Reaching the Throwable also not working. Here is my code. Code: - com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@f1f051 ...