IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Hibernate Java Discussion :

hibernate mysql eclipse


Sujet :

Hibernate Java

  1. #1
    Débutant
    Inscrit en
    Septembre 2007
    Messages
    372
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 372
    Points : 86
    Points
    86
    Par défaut hibernate mysql eclipse
    Bonjour, je suis entrain de suivre l'exemple de developpez.com sur hibernate/sql server mais moi je travaille avec mysql, voila mon fichier de configuration :
    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
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-configuration
        PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
     
    <hibernate-configuration>
        <session-factory >
     
    		<!-- local connection properties -->
    		<property name="hibernate.connection.url">jdbc:mysql-connector-java-3.0.17-ga-bin:mysql ://127.0.0.1:Base1</property>
    		<property name="hibernate.connection.driver_class">net.sourceforge.mysql.jdbc.Driver</property>
    		<property name="hibernate.connection.username">user1</property>
    		<property name="hibernate.connection.password">password</property>
    		<!-- property name="hibernate.connection.pool_size"></property -->
     
    		<!-- dialect for DB2 -->
            <property name="dialect">net.sf.hibernate.dialect.DB2Dialect</property>
     
            <property name="hibernate.show_sql">false</property>
            <property name="hibernate.use_outer_join">true</property>
            <!--
            <property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property> 
            <property name="jta.UserTransaction">java:comp/UserTransaction</property> -->
     
    		<property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
        </session-factory>
    </hibernate-configuration>
    j'ai problème concernat : <session-factory >, il me dit : the content of element type "session-factory" is incomplete, it must match "property*,mapping,(", en plus malgré que j'ai mis le connecteur jdbc:mysql-connector-java-3.0.17-ga-bin.java dans les librairies il me donne le message d'erreur lorsque je veux créer mon fichier de mapping puisqu'il ne reconnait pas ma base de donnée : "Base1", aidez moi svp ?

  2. #2
    Débutant
    Inscrit en
    Septembre 2007
    Messages
    372
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 372
    Points : 86
    Points
    86
    Par défaut problème avec hibernate mysql
    ok, voila j'ai pu surmonter cette étape, mais à la fin du doc j'ai eu les problèmes suivant :
    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
    18 févr. 2008 11:18:40 net.sf.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 2.1.6
    18 févr. 2008 11:18:40 net.sf.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    18 févr. 2008 11:18:40 net.sf.hibernate.cfg.Environment <clinit>
    INFO: using CGLIB reflection optimizer
    18 févr. 2008 11:18:40 net.sf.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    18 févr. 2008 11:18:40 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    18 févr. 2008 11:18:40 net.sf.hibernate.util.XMLHelper$ErrorLogger error
    GRAVE: Error parsing XML: /hibernate.cfg.xml(21) The content of elements must consist of well-formed character data or markup.
    18 févr. 2008 11:18:40 net.sf.hibernate.cfg.Configuration doConfigure
    GRAVE: problem parsing configuration/hibernate.cfg.xml
    org.dom4j.DocumentException: Error on line 21 of document  : The content of elements must consist of well-formed character data or markup. Nested exception: The content of elements must consist of well-formed character data or markup.
    	at org.dom4j.io.SAXReader.read(SAXReader.java:355)
    	at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:953)
    	at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
    	at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
    	at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:10)
    	at Test.main(Test.java:6)
    Nested exception: 
    org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
    	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    	at org.dom4j.io.SAXReader.read(SAXReader.java:339)
    	at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:953)
    	at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
    	at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
    	at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:10)
    	at Test.main(Test.java:6)
    Exception in thread "main" java.lang.ExceptionInInitializerError
    	at Test.main(Test.java:6)
    Caused by: java.lang.RuntimeException: Problème de configuration : problem parsing configuration/hibernate.cfg.xml
    	at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:12)
    	... 1 more
    Caused by: net.sf.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml
    	at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:958)
    	at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
    	at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
    	at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:10)
    	... 1 more
    Caused by: org.dom4j.DocumentException: Error on line 21 of document  : The content of elements must consist of well-formed character data or markup. Nested exception: The content of elements must consist of well-formed character data or markup.
    	at org.dom4j.io.SAXReader.read(SAXReader.java:355)
    	at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:953)
    	... 4 more
    Merci pour votre aide !!!


  3. #3
    Membre du Club
    Inscrit en
    Janvier 2007
    Messages
    82
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 82
    Points : 60
    Points
    60
    Par défaut Précisions sur ton souci
    Bonjour,

    Pourrais-tu préciser ce que tu as à la ligne 21 de ton hibernate.cfg.xml

    Si c'est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    jdbc:mysql-connector-java-3.0.17-ga-bin:mysql ://127.0.0.1:Base1
    remplace par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    jdbc:mysql://127.0.0.1:Base1
    car le .jar doit être ajouté aux librairies mais son nom ne doit pas figurer dans le code.

    En espérant t'avoir aidé...

  4. #4
    Débutant
    Inscrit en
    Septembre 2007
    Messages
    372
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 372
    Points : 86
    Points
    86
    Par défaut
    merci pour votre interet mais j'ai deja rectifié ca !

Discussions similaires

  1. [hibernate] Tutoriel eclipse+hibernate synchronizer
    Par Didier69 dans le forum Eclipse Java
    Réponses: 4
    Dernier message: 06/10/2005, 16h19
  2. [Plugin][Hibernate Synchronizer]Hibernate sous Eclipse
    Par Kalou75 dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 01/10/2005, 23h28
  3. Problèmes avec Hibernate (sous Eclipse)
    Par Pierric dans le forum Hibernate
    Réponses: 2
    Dernier message: 07/04/2005, 14h35
  4. Hibernate + mySql + Eclipse
    Par Goupil dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 14/02/2005, 14h02
  5. [Mysql] [eclipse] questions sur l'installation
    Par sandusa dans le forum Eclipse Java
    Réponses: 4
    Dernier message: 18/03/2004, 11h26

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo