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
|