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.