Thanks in advance for any help. I am trying to use JEE 5 Persistence, but I can't get my j2se app to run.
I am using:
Hibernate Core 3.2, Hibernate Annotations 3.2 CR1, and Hibernate EntityManager 3.2 CR1.
The error:
javax.persistence.PersistenceException: No Persistence provider for EntityManager named sample
The code:
factory = Persistence.createEntityManagerFactory("sample");
manager = factory.createEntityManager();
persistence.xml is in META-INF in the bin folder. bin is in the classpath.
ClassLoader.getSystemResource("META-INF/persistence.xml");
works fine.
Contents of persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/ ... ce_1_0.xsd"
version="1.0">
<persistence-unit name="sample" transaction-type="RESOURCE_LOCAL">
<class>rgc.Person</class>
<properties>
<property name="hibernate.connection.driver_class"
value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username"
value="root"/>
<property name="hibernate.connection.password"
value="z8pp8lin"/>
<property name="hibernate.connection.url"
value="jdbc:mysql://localhost/hibtest"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto"
value="update"/>
</properties>
</persistence-unit>
</persistence>
Thanks again for ay advice....