I am attempting to make use of the new EntityManager in a standalone application. I created the persistence.xml file listed below and put it in my META-INF directory. I know the file is being read because if I purposefully put invalid XML in it, it gives me an exception. Note, I don't have a .par file (don't know whether that's required or not) (it's just in a .jar file with the rest of my application). I'm receiving the exception listed below which indicates that I didn't specify any class files. I can get it to work if I specify hibernate.ejb.cfgfile and use a hibernate.cfg.xml file. Has anyone else run into this problem or know what I'm doing wrong?
Hibernate version: hibernate-3.1alpha1, hibernate-annotations-3.1beta3, hibernate-entitymanager-3.1beta1
Mapping documents:
persistence.xml
Code:
<?xml version="1.0"
encoding="UTF-8"?>
<entity-manager>
<name>bb_bb60</name>
<class>edu.uchicago.at.blackboard.persistence.entity.CourseRole</class>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle9Dialect"/>
<property name="hibernate.connection.driver_class"
value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.connection.url"
value="jdbc:oracle:thin:@localhost:1522:BB60"/>
<property name="hibernate.connection.username"
value=""/>
<property name="hibernate.connection.password"
value=""/>
</properties>
</entity-manager>
Code between sessionFactory.openSession() and session.close():Code:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("bb_bb60");
Full stack trace of any exception that occurs:Code:
Jun 28, 2005 5:06:53 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.1alpha1
Jun 28, 2005 5:06:53 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Jun 28, 2005 5:06:53 PM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Jun 28, 2005 5:06:53 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
javax.persistence.PersistenceException: org.hibernate.MappingException: Neither classes declared nor hibernate.cfg.xml file available
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:100)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:42)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:29)
at edu.uchicago.at.blackboard.test.Test.main(Test.java:41)
Caused by: org.hibernate.MappingException: Neither classes declared nor hibernate.cfg.xml file available
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:136)
at org.hibernate.ejb.HibernatePersistence.createFactory(HibernatePersistence.java:77)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:93)
... 3 more