-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: -No persistence provider for EntityManager named agenda-
PostPosted: Thu Oct 19, 2006 11:38 pm 
Newbie

Joined: Thu Oct 19, 2006 11:23 pm
Posts: 1
Hello,

I'm following a small tutorial on persistence (http://today.java.net/pub/a/today/2006/ ... loper.html), using the hibernate (Hibernate Core, Hibernate Annotations, and Hibernate Entity Manage) and hsqldb jars, the persistence.xml file is create and the hsqldb is on the META-INF dir on the SRC directory of the NetBeans project, this is the file:

<?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="agenda" transaction-type="RESOURCE_LOCAL">
<class>addressbook.Person</class>

<properties>
<property name="hibernate.connection.driver_class"
value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.username"
value="sa"/>
<property name="hibernate.connection.password"
value=""/>
<property name="hibernate.connection.url"
value="jdbc:hsqldb:hsql:agenda"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto"
value="update"/>
</properties>

</persistence-unit>
</persistence>


I use a class for the operations and another for the object to persists. The initialization code for both the hsqldb and hibernate is the following (removed the try..)


EntityManagerFactory factory;
EntityManager manager;

// start hypersonic
Class.forName("org.hsqldb.jdbcDriver").newInstance();
Connection c = DriverManager.getConnection(
"jdbc:hsqldb:file:agenda", "sa", "");

factory = Persistence.createEntityManagerFactory("agenda");
manager = factory.createEntityManager();


The files for the local database "agenda" are created in the working directory, but error occurs at this line:

factory = Persistence.createEntityManagerFactory("agenda");

The error says that -No persistence provider for EntityManager named agenda-.

Didnt find much help on the web because people who got this error were using either Derby or Oracle so they had a <provider></provider> tag on the persistence.xml , yet this example is supose to work locally on hsqldb.


Hibernate version:

hibernate-3.2
hibernate-annotations-3.1beta9
hibernate-entitymanager-3.1beta7
HSQLDB 1.8.0.7


Any hints on what am I missing ?

Thank you in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 25, 2006 11:32 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
try adding
<provider>org.hibernate.ejb.HibernatePersistence</provider>

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.