Hi,
I'm using Hibernate Tools 3.2.0 Beta9a and I try to get a JPA based console configuration (checking the JPA (jdk 1.5+) radio button in "Create Hibernate Console Configuration"). It's working when supplying a hibernate.cfg.xml (and using the "Core" setting), but won't when using the persistence.xml.
My persistence.xml:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="KundenbeispielJPA">
<properties>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.hbm2ddl.auto" value="create"/>
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:hsql://localhost:1701/"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
</properties>
</persistence-unit>
</persistence>
My hibernate.cfg.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="hibernate.connection.url">jdbc:hsqldb:hsql://127.0.0.1:1701</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.session_factory_name">java:hibernate/SessionFactory</property>
</session-factory>
</hibernate-configuration>
The Exception I get:
Code:
org.hibernate.console.HibernateConsoleRuntimeException: Could not load JPA Configuration
org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
java.lang.reflect.InvocationTargetException: <no message>
javax.persistence.PersistenceException: [PersistenceUnit: KundenbeispielJPA] class or package not found
java.lang.ClassNotFoundException: [color=red]bin.[/color]de.xyz.model.Kunden
My java File:
Code:
package de.xyz.model;
// Generated 17.04.2007 14:21:10 by Hibernate Tools 3.2.0.b9
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* Kunden generated by hbm2java
*/
@Entity
@Table(name = "KUNDEN", schema = "PUBLIC")
public class Kunden implements java.io.Serializable {
private static final long serialVersionUID = 3887336267590432399L;
private Long id;
private String vorname;
private String nachname;
public Kunden() {
}
public Kunden(Long id) {
this.id = id;
}
public Kunden(Long id, String vorname, String nachname) {
this.id = id;
this.vorname = vorname;
this.nachname = nachname;
}
@Id
@Column(name = "ID", precision = 646456993, scale = 0)
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name = "VORNAME", length = 50)
public String getVorname() {
return this.vorname;
}
public void setVorname(String vorname) {
this.vorname = vorname;
}
@Column(name = "NACHNAME", length = 50)
public String getNachname() {
return this.nachname;
}
public void setNachname(String nachname) {
this.nachname = nachname;
}
}
I understand the exception since there is no "bin.de.xyz.model.Kunden", but there is a "de.xyz.model.Kunden". I don't understand how the bin. is getting there.
Probably I did some smaller error but I'm searching for hours now and just don't get it working.