For testing purpose I am trying to make a JPA connection to our database.
I get an error saying:
Code:
Unable to configure EntityManagerFactory
with no further explanation!
I think I have tried everything in my persistence file and now finally I give up.
My persistence.xml (only the persistence-unit):
Code:
<persistence-unit name="Test" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>dme.dm.device.Operation</class>
<class>dme.dm.device.Action</class>
<properties>
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username"
value="jb"/>
<property name="hibernate.connection.password"
value="123"/>
<property name="hibernate.connection.url"
value="jdbc:mysql://127.0.0.1/dm"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto"
value="update"/>
</properties>
</persistence-unit>
And I make the call like this:
Code:
public class OperationTest {
private EntityManager entityManager;
@Before
public void setUp() {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("Test");
entityManager = emf.createEntityManager();
}
}
When I run this code I get the exception:
Code:
javax.persistence.PersistenceException: [PersistenceUnit: Test] Unable to configure EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:265)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
Does anyone have an idea of what could be wrong?
Regards,
Thomas