hi!
i want to use hibernate, ejb3 and the entitymanager, but i got the exception displayed below. i get the exception when executing the following code in my main-method (exactly when calling createEntityMangerFactory):
Code:
public static void main (String[] args) {
// Use persistence.xml configuration
EntityManagerFactory emf = Persistence.createEntityManagerFactory("IngresManager");
EntityManager em = emf.createEntityManager(); // Retrieve a transactional-scoped entity manager
//Work with the EM
em.close();
emf.close(); //close at application end
}
i know this is a simple problem, but i don't know where i have to put my jdbc-driver (= edbc.jar from ingres database) that hibernate can use it.
my folder structure is as follows:
DipasNgHibernate (Eclipse Project)
|
- src (hibernate.cfg.xml and source-files)
|
- META-INF (including persistence.xml)
- bin
- lib (with all the hibernate3 and related libs plus edbc.jar)
any hints are appreciated.
regards
patrik
my environment:
eclipse 3.1rc4, jdk1.5
Hibernate version: 3.1alpha1, the latest annotations (3.1beta3) and latest entity-manager (3.1beta1)
persistence.xml from META-INFCode:
<?xml version="1.0" encoding="UTF-8"?>
<entity-manager>
<name>IngresManager</name>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>ams.ingres.PvStamp</class>
<class>ams.ingres.PvFamip</class>
<properties>
<property name="hibernate.connection.username">ingres</property>
<property name="hibernate.connection.password">ingres</property>
<property name="hibernate.dialect">org.hibernate.dialect.IngresDialect</property>
<property name="hibernate.connection.url">jdbc:edbc://192.168.193.132:21071/dipasdem</property>
<property name="hibernate.connection.driver_class">ca.edbc.jdbc.EdbcDriver</property>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
</entity-manager>
Full stack trace of any exception that occurs:Code:
FATAL DriverManagerConnectionProvider:65 - JDBC Driver class not found:
java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:109)
at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:61)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:80)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:362)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:60)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1429)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:980)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:182)
at org.hibernate.ejb.HibernatePersistence.createFactory(HibernatePersistence.java:77)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:93)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:42)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:29)
at ams.hibernate.PvStampManager.main(PvStampManager.java:12)
Name and version of the database you are using: