-->
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.  [ 3 posts ] 
Author Message
 Post subject: problème dans mon fichier ant avec hibernateTool
PostPosted: Fri Feb 05, 2010 12:31 pm 
Newbie

Joined: Thu Jan 14, 2010 1:03 pm
Posts: 2
bonjour a tous les membres de Développez.com je vous remercie pour l'aide quotidienne que vous nous apporté c'est vraiment gentil car cela nous fait gagner du temps.
je lis actuellement le cours de Mr Serge Tahé (introduction a Java EE) mon OS est win XP ma version de java est 1.6
c'est dans ce cadre que j'ai crée 4 entitées , mais lorsque j'exécute la tache DDL de mon fichier ant dans netbeans j'ai le message d'erreur suivant:
Code:
Project base dir set to: C:\u-metier-dao-jpa-spring-hibernate
Build sequence for target(s) `DDL' is [DDL]
Complete build sequence is [DDL, BD, ]
DDL:
Executing Hibernate Tool with a JPA Configuration
1. task: hbm2ddl (Generates database schema)
17:28:17,765 ERROR PersistenceXmlLoader:246 - Error parsing XML: XML InputStream(35) cvc-complex-type.2.3: Element 'properties' cannot have character [children], because the type's content type is element-only.
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.reflect.InvocationTargetException
javax.persistence.PersistenceException: invalid persistence.xml
org.xml.sax.SAXParseException: cvc-complex-type.2.3: Element 'properties' cannot have character [children], because the type's content type is element-only.
C:\u-metier-dao-jpa-spring-hibernate\ant-hibernate.xml:26: Problems in creating a configuration for JPA. Have you remembered to add hibernate EntityManager jars to the classpath ?
        at org.hibernate.tool.ant.JPAConfigurationTask.createConfiguration(JPAConfigurationTask.java:57)
        at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
        at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:302)
        at org.hibernate.tool.ant.Hbm2DDLExporterTask.createExporter(Hbm2DDLExporterTask.java:51)
        at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
        at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:278)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:497)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.hibernate.tool.ant.JPAConfigurationTask.createConfiguration(JPAConfigurationTask.java:43)
        ... 21 more
Caused by: javax.persistence.PersistenceException: invalid persistence.xml
        at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:72)
        at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:89)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:222)
        ... 26 more
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.3: Element 'properties' cannot have character [children], because the type's content type is element-only.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3116)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3076)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:2978)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2121)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:791)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
        at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:70)
        ... 28 more
--- Nested Exception ---
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.hibernate.tool.ant.JPAConfigurationTask.createConfiguration(JPAConfigurationTask.java:43)
        at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:54)
        at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:302)
        at org.hibernate.tool.ant.Hbm2DDLExporterTask.createExporter(Hbm2DDLExporterTask.java:51)
        at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
        at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:278)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:497)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: javax.persistence.PersistenceException: invalid persistence.xml
        at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:72)
        at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:89)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:222)
        ... 26 more
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.3: Element 'properties' cannot have character [children], because the type's content type is element-only.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3116)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3076)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:2978)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2121)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:791)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
        at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:70)
        ... 28 more
BUILD FAILED (total time: 1 second)


ce qui me laisse perplexe c'est que sous eclipse tous marchent a merveille la tache bd du script ant est exécuté sans problème.

svp aidé moi résoudre l'erreur sous netbeans. merci d'avance

voici le code des différents fichiers:

1 - Cotisation
Code:
import javax.persistence.Id;
import javax.persistence.Version;
import javax.persistence.Column;
import javax.persistence.Table;

/**
*
* @author Administrateur
*/
@SuppressWarnings("unused")
@Entity
@Table(name="Cotisation")

public class Cotisation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Version
    @Column(nullable=false)
    private int version;
   
    @Column(nullable=false)
    private float csgrds;
   
    @Column(nullable=false)
    private float csgd;
   
    @Column(nullable=false)
    private float secu;
   
    @Column(nullable=false)
    private float retraite;

    //Constructeur
    public Cotisation(){

    }
    public Cotisation(float csgrds, float csgd, float secu, float retraite){

        setcsgrds(csgrds);
        setcsgd(csgd);
        setsecu(secu);
        setretraite(retraite);
    }

    // getter and setter
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getversion() {
        return version;
    }

    public void setversion(int version) {
        this.version = version;
    }

    public float getcsgrds() {
        return csgrds;
    }

    public void setcsgrds(float csgrds) {
        this.csgrds = csgrds;
    }

    public float getcsgd() {
        return csgd;
    }

    public void setcsgd(float csgd) {
        this.csgd = csgd;
    }
    public float getsecu() {
        return secu;
    }

    public void setsecu(float secu) {
        this.secu = secu;
    }
   
    public float getretraite() {
        return retraite;
    }

    public void setretraite(float retraite) {
        this.retraite = retraite;
    }


// hashcode pour l'instant je ne le maitrise pas encore mais ça viendras
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cotisation)) {
            return false;
        }
        Cotisation other = (Cotisation) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.Cotisation[id=" + id + "]";
    }

}


2- Adresse

Code:
package jpa;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
*
* @author Administrateur
*/
@SuppressWarnings("serial")
@Embeddable

public class Adresse implements Serializable {
    private static final long serialVersionUID = 1L;

    @Column(nullable=false, length=30)
    private String adr;

     @Column(length=30)
    private String adr1;

      @Column(length=30)
    private String adr2;

      @Column(nullable=false)
    private short code_postale;

      @Column(nullable=false, length=25)
    private String ville;

      @Column(nullable=false, length=30)
    private String pays;

      // constructeur
      public Adresse(){
      }

      public Adresse(String adr, String adr1, String adr2, short code_postale, String ville, String pays){
          setadr(adr);
          setadr1(adr1);
          setadr2(adr2);
          setcode_postale(code_postale);
          setville(ville);
          setpays(pays);
      }

      //getter and setter

       public String getadr() {
        return adr;
         }

        public void setadr(String adr) {
        this.adr = adr;
        }

         public String getadr1() {
        return adr1;
         }

        public void setadr1(String adr1) {
        this.adr1 = adr1;
        }

         public String getadr2() {
        return adr2;
         }

        public void setadr2(String adr2) {
        this.adr2 = adr2;
        }

         public short getcode_postale() {
        return code_postale;
         }

        public void setcode_postale(short code_postale) {
        this.code_postale = code_postale;
        }

        public String getville() {
        return ville;
         }

        public void setville(String ville) {
        this.ville = ville;
        }

        public String getpays() {
        return pays;
         }

        public void setpays(String pays) {
        this.pays = pays;
        }

    @Override
    public String toString() {
        return "jpa.Adresse[adr=" + adr + "]";
    }

}


3- Indemnités

Code:
import javax.persistence.Id;
import javax.persistence.Version;
import javax.persistence.Column;
import javax.persistence.Table;

/**
*
* @author Administrateur
*/
@SuppressWarnings("unused")
@Entity
@Table(name="Indemnites")

public class Indemnites implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
   
    @Version
    @Column(nullable=false)
    private int version;

    @Column(nullable=false, unique=true)
    private byte indice;

    @Column(nullable=false)
    private float baseHeure;

    @Column(nullable=false)
    private float entretienJour;

    @Column(nullable=false)
    private float repasJour;

    @Column(nullable=false)
    private float indemnitesCp;


    //Constructeur
      public Indemnites(){
      }
     
      public Indemnites(byte indice, float baseHeure, float entretienJour, float repasJour, float indemnitesCp){
     
          setindice(indice);
          setbaseHeure(baseHeure);
          setentretienJour(entretienJour);
          setrepasJour(repasJour);
          setindemnitesCp(indemnitesCp);
         
      }
    //getters and setters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getversion() {
        return version;
    }

    public void setversion(int version) {
        this.version = version;
    }

    public byte getindice() {
        return indice;
    }

    public void setindice(byte indice) {
        this.indice = indice;
    }

   public float getbaseHeure() {
        return baseHeure;
    }

    public void setbaseHeure(float baseHeure) {
        this.baseHeure = baseHeure;
    }

    public float getentretienJour() {
        return entretienJour;
    }

    public void setentretienJour(float entretienJour) {
        this.entretienJour = entretienJour;
    }

    public float getrepasJour() {
        return repasJour;
    }

    public void setrepasJour(float repasJour) {
        this.repasJour = repasJour;
    }

    public float getindemnitesCp() {
        return indemnitesCp;
    }

    public void setindemnitesCp(float indemnitesCp) {
        this.indemnitesCp = indemnitesCp;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Indemnites)) {
            return false;
        }
        Indemnites other = (Indemnites) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.Indemnites[id=" + id + "]";
    }

}


4 - Personne

Code:
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Version;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
*
* @author Administrateur
*/
@SuppressWarnings("unused")
@Entity
@Table(name="Employes")

public class Employes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
   
    @Version
    @Column(nullable=false)
    private int version;

    @Column(nullable=false, unique=true)
    private Long SS;

    @Column(nullable=false, length=30)
    private String nom;

    @Column(nullable=false, length=50)
    private String prenom;

    @Column(nullable=false, length=30)
    @Temporal(TemporalType.DATE)
    private Date dateNaissance;
   
    @Embedded
    private Adresse adresse;

    @OneToOne(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @JoinColumn(name="Indice_id", nullable=false, unique=true)
    private Indemnites indemnites;

    //Constructeur

    public Employes(){
    }

    public Employes(Long SS, String nom, String prenom, Date dateNaissnce, Adresse adresse, Indemnites indemnites){

        setSS(SS);
        setnom(nom);
        setprenom(prenom);
        setdateNaissance(dateNaissance);
        setadresse(adresse);
        setindemnites(indemnites);

    }

    //Setters and Getters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

     public int getversion() {
        return version;
    }

    public void setversion(int version) {
        this.version = version;
    }

    public Long getSS() {
        return SS;
    }

    public void setSS(Long SS) {
        this.SS = SS;
    }

    public String getnom() {
        return nom;
    }

    public void setnom(String nom) {
        this.nom = nom;
    }

     public String getprenom() {
        return prenom;
    }

    public void setprenom(String prenom) {
        this.prenom = prenom;
    }

    public Date getdateNaissance() {
        return dateNaissance;
    }

    public void setdateNaissance(Date dateNaissance) {
        this.dateNaissance = dateNaissance;
    }

    public Adresse getadresse() {
        return adresse;
    }

    public void setadresse(Adresse adresse) {
        this.adresse = adresse;
    }

    public Indemnites getindemnites() {
        return indemnites;
    }

    public void setindemnites(Indemnites indemnites) {
        this.indemnites = indemnites;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Employes)) {
            return false;
        }
        Employes other = (Employes) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "jpa.Employes[id=" + id + "]";
    }


mon fichier de configuration persistance est le suivant:

persistence.xml:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
  <persistence-unit name="jpa" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <properties>

        <!-- log sql
      <property name="hibernate.show.sql" value="true" />
      <property name="hibernate.format.sql" value="true" />
      <property name="hibernate.sql.comments" value="true" />
      -->

      <!-- Connexion au JDBC -->
      <property name="hibernate.archive.autodetection" value="class, hbm"/>
      <property name="hibernate.connection.username" value="dbpam"/>
      <property name="hibernate.connection.driver_class" value="org.firebirdsql.jdbc.FBDriver"/>
      <property name="hibernate.connection.password" value="dbpam"/>
      <property name="hibernate.connection.url" value="jdbc:firebirdsql://localhost:3050/C:\Documents and Settings\Administrateur\Mes documents\NetBeansProjects\dbpam\dbpam.fdb"/>
      <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
      <property name="hibernate.hbm2ddl.auto" value="create-drop"/>

      <!-- dialect -->
      <property name="hibernate.dialect" value="org.hibernate.dialect.FirebirdDialect"/>

     <!--  propriétés DataSource c3p0 -->

        <property name="hibernate.c3p0.min_size" value="5"/>
   <property name="hibernate.c3p0.max_size" value="20"/>
   <property name="hibernate.c3p0.timeout" value="300"/>
   <property name="hibernate.c3p0.max_statements" value="50"/>
   <property name="hibernate.c3p0.idle_test_period" value="3000"/>
    <property name="hibernate.c3p0.timeout" value="300"/><property name="hibernate.c3p0.max_statements" value="50"/><property name="hibernate.c3p0.idle_test_period" value="3000"/>

        /
      </properties>
  </persistence-unit>
</persistence>
mon script ant est le suivant:
Code :
[code]<?xml version="1.0" encoding="UTF-8"?>
<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}">
      <include name="**/*.jar" />
      </fileset>
   </path>[/code]

    <!-- 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}">
         <!--<classpath path="${build.dir}" />
          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}">
         <!--<classpath path="${build.dir}" />
          Utiliser META-INF/persistence.xml -->
         <jpaconfiguration />
         <!-- export -->
         <hbm2ddl drop="true" create="true" export="true" outputfilename="ddl/schema.sql" delimiter=";" format="true" />
      </hibernatetool>
   </target>
</project>


Top
 Profile  
 
 Post subject: Re: problème dans mon fichier ant avec hibernateTool
PostPosted: Tue Feb 09, 2010 6:21 am 
Newbie

Joined: Wed Jan 27, 2010 10:11 am
Posts: 3
Au vu de la trace, il s'agit d'un probléme de parseur sur le fichier persistence.xml.

As tu vu qu'il reste un "/" tout seul dans ce fichier?

"
<property name="hibernate.c3p0.timeout" value="300"/><property name="hibernate.c3p0.max_statements" value="50"/><property name="hibernate.c3p0.idle_test_period" value="3000"/>
/
</properties>
"

Sous eclipse, tu dois sans doute utiliser un parseur moins regardant sur la structure, ce qui explique la différence de comportement.


Top
 Profile  
 
 Post subject: Re: problème dans mon fichier ant avec hibernateTool
PostPosted: Wed Feb 10, 2010 6:25 pm 
Newbie

Joined: Thu Jan 14, 2010 1:03 pm
Posts: 2
merci infiniment hernal j'arrive pas a croire que c'était cela l'erreur. grâce a toi je vais pouvoir avancé car après avoir corrigé l'erreur et ajouté le jar freemarker au classpath de l'application la tache s'exécute proprement.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.