Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.2.0.cr2
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Code:
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named dnd
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:41)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
at org.persistence.impl.Test.main(Test.java:17)
Name and version of the database you are using: MS-SQL Server 2005
The generated SQL (show_sql=true):Debug level Hibernate log excerpt:I am just trying to open up an entityManager, as a start. I am sure my database properties aren't set right anyway, but I want to first get a different exception, to deal with it.
So far, my code is:
Code:
System.out.println(1);
EntityManagerFactory entityManagerFactory = Persistence
.createEntityManagerFactory("sample");
System.out.println(2);
EntityManager entityManager = entityManagerFactory
.createEntityManager();
System.out.println(3);
entityManager.close();
System.out.println(4);
entityManagerFactory.close();
System.out.println(5);
and my persistence.xml file is:
Code:
<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/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="sample" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ej.HibernatePersistence</provider>
<properties>
<property name="hibernate.dialect"
value="org.hibernate.dialect.SQLServerDialect" />
<property name="hibernate.connection.driver_class"
value="hibernate.connection.driver_class" />
<property name="hibernate.connection.url"
value="jdbc:sqlserver://." />
<property name="hibernate.connection.username" value="dnd" />
<property name="hibernate.connection.password" value="dnd" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
I have the ejb3-persistence.jar, hibernate-annotations.jar (3.2.0.CR1), hibernate-entitymanager.jar (3.2.0.CR1) files in my classpath as well, and am using eclipse 3.2 for win x64
I also put the META-INF folder as a source folder in my project. Figured it had to be, in order for the persistence.xml to get to the bin at the end.
Anyone here has any tip about it?