[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Making a client-side JPA connection

homaxto do-not-reply at jboss.com
Thu Sep 11 04:05:35 EDT 2008


For testing purpose I am trying to make a JPA connection to our database. 
I get an error saying:
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):
<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="jboss"/>
  |         <property name="hibernate.connection.password"
  |                   value="banan123"/>
  |         <property name="hibernate.connection.url"
  |                   value="jdbc:mysql://172.16.12.15/dm_tos"/>
  |         <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:
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:
javax.persistence.PersistenceException: [PersistenceUnit: Test] Unable to configure EntityManagerFactory

Does anyone have an idea of what could be wrong?

Regards,
Thomas

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4175780#4175780

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4175780



More information about the jboss-user mailing list