-->
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: HibernatePersistence or Persistence?? Which use?
PostPosted: Thu Sep 29, 2005 4:12 pm 
Beginner
Beginner

Joined: Wed Apr 27, 2005 8:27 am
Posts: 27
Hello guys,

In both cases I received an exception.

If I use:

HibernatePersistence hbPersist = new HibernatePersistence();
EntityManagerFactory emf = hbPersist.createEntityManagerFactory ("sistemabancario", new HashMap());

I receive:

javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not instantiate dialect class

My persistence.xml is:

<entity-manager>
<name>sistemabancario</name>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>sistemaBancario.servidor.persistencia.vo.BancarioVo</class>
<class>sistemaBancario.servidor.persistencia.vo.PessoaFisicaVo</class>
<jta-data-source>java:/DefaultDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost/sistemabancario"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
</entity-manager>

and hibernate3.jar is in my classpath.

If I use:

EntityManagerFactory emf = Persistence.createEntityManagerFactory("sistemabancario");

I receive:

java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence

Does anyone know what's wrong?

Which one should I use?

Thanks, Guilherme


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.