salut,

avec un petit projet JPA sous netbeans 6.9 RC2, macos X.5,glassfish v3 et mysql (version MAMP) j'ai cette erreur au lancement d'un script de création de la base de données à partir des classes JPA :

BD:
Executing Hibernate Tool with a JPA Configuration
1. task: hbm2ddl (Generates database schema)
log4j:WARN No appenders could be found for logger (org.hibernate.ejb.Version).
log4j:WARN Please initialize the log4j system properly.
An exception occurred while running exporter #2:hbm2ddl (Generates database schema)
To get the full stack trace run ant with -verbose
Problems in creating a configuration for JPA. Have you remembered to add hibernate EntityManager jars to the classpath ?
java.lang.NoSuchMethodException: org.hibernate.ejb.Ejb3Configuration.configure(java.lang.String, java.util.Map)
/Users/oliviersaint-eve/NetBeansProjects/pam_scratch_spring_jpa/ant_hibernate.xml:36: Problems in creating a configuration for JPA. Have you remembered to add hibernate EntityManager jars to the classpath ?
ÉCHEC DE LA GÉNÉRATION (durée totale* 1 seconde)
j'ai (voir photo) le jar "hibernate-entitymanager", qui contient bien la bonne méthode avec la bonne signature (du moins les paramètres d'entrée).
voici mes jars: voir la photo, ils y sont tous.


voici le script :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
<project name="jpa-hibernate" default="DDL" basedir=".">
 
   <!-- nom du projet et version -->
   <property name="proj.name" value="jpa-hibernate" />
   <property name="proj.shortname" value="jpa-hibernate" />
   <property name="version" value="1.0" />
 
   <!-- Propriété globales -->
   <property name="src.java.dir" value="src" />
  <property name="dist.dir" value="dist" />
 
  <!-- le Classpath du projet -->
  <path id="project.classpath">
    <fileset dir="${dist.dir}/lib">
      <include name="*.jar" />
    </fileset>
  </path>
 
  <!-- Hibernate Tools -->
  <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="project.classpath"/>
 
  <!-- Générer le schéma de la base -->
  <target name="DDL" description="Génération DDL base">
    <hibernatetool destdir="${basedir}">
      <!-- Utiliser META-INF/persistence.xml -->
      <jpaconfiguration />
      <!-- export -->
      <hbm2ddl drop="true" create="true" export="false" outputfilename="ddl/schema.sql"
delimiter=";" format="true" />
    </hibernatetool>
  </target>
 
  <!-- Générer la base -->
  <target name="BD" description="Génération BD">
    <hibernatetool destdir="${basedir}">
      <!-- Utiliser META-INF/persistence.xml -->
      <jpaconfiguration persistenceunit="pam_scratch_spring_jpaPU_auto"/>
      <!-- export -->
      <hbm2ddl drop="true" create="true" export="true" outputfilename="ddl/schema.sql"
delimiter=";" format="true" />
    </hibernatetool>
  </target>
</project>
la tâche que je lance est "BD".

voici (ça doit être un peu indigeste mais je ne vois pas d'autre moyen) persistence.xml:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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_2_0.xsd">
  <persistence-unit name="pam_scratch_spring_jpaPU_auto" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>jpa.Cotisations</class>
    <class>jpa.Employes</class>
    <class>jpa.Indemnites</class>
    <properties>
      <property name="hibernate.connection.username" value="lolveley"/>
      <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
      <property name="hibernate.connection.password" value="*******"/>
      <property name="hibernate.connection.url" value="jdbc:mysql://localhost:8889/pam_auto"/>
      <property name="hibernate.hbm2ddl.auto" value="update"/>
    </properties>
  </persistence-unit>
</persistence>
voilà... je ne sais pas comment continuer.
olivier