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 :

Erreur fichier de mapping Hibernate


Sujet :

Hibernate Java

  1. #1
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 20
    Points : 12
    Points
    12
    Par défaut Erreur fichier de mapping Hibernate
    bonjour ,
    je veux créer un fichier de mapping hibernate, mais lorsque je clique sur "refresh"
    je reçois un message d'erreur
    this is most likely due to to the URL not matching the expected value by the JDBC driver. please verify your settings
    Que dois-je faire svp sachant que j'ai réussi avant à faire la connexion avec hibernate et jai suivi la même procédure pour le 2ème projet ?
    Il y t il quelqu'un qui a eu le même problème que moi?
    Merci !!

  2. #2
    Membre du Club
    Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2008
    Messages
    59
    Détails du profil
    Informations personnelles :
    Âge : 35
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Octobre 2008
    Messages : 59
    Points : 61
    Points
    61
    Par défaut
    Peux tu poster ton fichier de mapping ?

  3. #3
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 20
    Points : 12
    Points
    12
    Par défaut
    Bonjour,
    En effet, j'arrive pas à générer un fichier de mapping.
    Ci dessous le code de mon fichier de configuration ainsi que les erreurs que j'obtienne lorsque j'essaye de rafraichir afin d'obtenir ma table sachant que jai une Base1 contenant une table t_contact


    hibernate.cfg.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
    18
    19
    20
    21
    22
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-configuration
        PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
     
    <hibernate-configuration>
        <session-factory >
     
    		<!-- local connection properties -->
    		<property name="hibernate.connection.url">jdbc:postgres://localhost/Base1</property>
    		<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
    		<property name="hibernate.connection.username">postgres</property>
    		<property name="hibernate.connection.password">postgres</property>
    		<!-- property name="hibernate.connection.pool_size"></property -->
     
    		<!-- dialect for DB2 -->
            <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
     
            <property name="hibernate.show_sql">false</property>
            <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
        </session-factory>
    </hibernate-configuration>
    Avant de rafraichir


    Uploaded with ImageShack.us

    après le rafraichissement


    Il y a t-il une personne qui peux m'aider car vraiment je suis bloquée et j'arrive pas à avancer !!
    Merci d'avance

  4. #4
    Membre expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 938
    Points : 3 938
    Points
    3 938
    Par défaut
    Essaie de changer cette ligne
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="dialect">org.hibernate.dialect.DB2Dialect</property>
    par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
    et redis nous...

  5. #5
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 20
    Points : 12
    Points
    12
    Par défaut
    Salut DevServlet,
    En effet, j'ai déjà essayé de configurer postgres dans le fichier de configuration d'hibernate mais ça marchait pas donc à force de répéter je mets pas défaut DB2.
    Malheureusement, ça marche toujours pas
    Sinon, écrire le fichier de mapping manuellement serait-il une bonne solution?
    Merci,

  6. #6
    Membre expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 938
    Points : 3 938
    Points
    3 938
    Par défaut
    As tu essayé la solution que je t'ai proposée? il faut que ton driver soit compatible avec le dialect de la base. sinon le reste de la conf parait correct.

  7. #7
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 20
    Points : 12
    Points
    12
    Par défaut
    Oui Oui, J'ai bien essayé mais ça marche pas.
    Je me casse la tête depuis plus qu'une semaine et je trouve pas l'erreur

  8. #8
    Membre expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 938
    Points : 3 938
    Points
    3 938
    Par défaut
    Effectivement y'avait une erreur dans ton url, remplace ca
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="hibernate.connection.url">jdbc:postgres://localhost/Base1</property>
    par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <property name="connection.url">jdbc:postgresql://localhost/Base1</property>

  9. #9
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 20
    Points : 12
    Points
    12
    Par défaut
    Malheureusement, ça marche toujours pas.
    Sinon, est ce que je suis obligée de passer par ce fichier de mapping?
    Puis je directement écrire mes classes manuellement?
    Merci,

  10. #10
    Membre expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 938
    Points : 3 938
    Points
    3 938
    Par défaut
    Moi perso je n'utilise hibernate que comme fournisseur de persistence, c'est à dire dans mon persistence.xml, c'est mon framework de persistence.xml, sinon tu peux tout editer manuellement. refais moi voir ton fichier de conf hibernate en l'etat actuel.

  11. #11
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 20
    Points : 12
    Points
    12
    Par défaut
    En effet, voici quelques essais

    1ier essai :
    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
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-configuration
        PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
     
    <hibernate-configuration>
        <session-factory >
     
    		<!-- local connection properties -->
    		<property name="hibernate.connection.url">jdbc:postgres://localhost/Base1</property>
    		<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
    		<property name="hibernate.connection.username">postgres</property>
    		<property name="hibernate.connection.password">postgres</property>
    		<!-- property name="hibernate.connection.pool_size"></property -->
     
    		<!-- dialect for PostgreSQL -->
            <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
     
            <property name="hibernate.show_sql">false</property>
            <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
        </session-factory>
    </hibernate-configuration>
    2ème essai
    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
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-configuration
        PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
     
    <hibernate-configuration>
        <session-factory >
     
    		<!-- local connection properties -->
    		<property name="connection.url">jdbc:postgres://localhost/Base1</property>
    		<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
    		<property name="hibernate.connection.username">postgres</property>
    		<property name="hibernate.connection.password">postgres</property>
    		<!-- property name="hibernate.connection.pool_size"></property -->
     
    		<!-- dialect for PostgreSQL -->
            <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
     
            <property name="hibernate.show_sql">false</property>
            <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
        </session-factory>
    </hibernate-configuration>
    3ème essai
    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
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-configuration
        PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
     
    <hibernate-configuration>
        <session-factory >
     
    		<!-- local connection properties -->
    		<property name="connection.url">jdbc:postgres://localhost/Base1</property>
    		<property name="connection.driver_class">org.postgresql.Driver</property>
    		<property name="connection.username">postgres</property>
    		<property name="connection.password">postgres</property>
    		<!-- property name="hibernate.connection.pool_size"></property -->
     
    		<!-- dialect for PostgreSQL -->
            <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
     
            <property name="hibernate.show_sql">false</property>
            <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
        </session-factory>
    </hibernate-configuration>
    Toutes ces configurations ne marchent pas

  12. #12
    Membre expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 938
    Points : 3 938
    Points
    3 938
    Par défaut
    Dans aucun des 3 essais tu n'as fait ce que j'ai demandé, prends ce fichier tel qu'il est :
    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
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-configuration
        PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
     
    <hibernate-configuration>
        <session-factory >
     
    		<!-- local connection properties -->
    		<property name="connection.url">jdbc:postgresql://localhost/Base1</property>
    		<property name="connection.driver_class">org.postgresql.Driver</property>
    		<property name="connection.username">postgres</property>
    		<property name="connection.password">postgres</property>
    		<!-- property name="hibernate.connection.pool_size"></property -->
     
    		<!-- dialect for PostgreSQL -->
            <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
     
            <property name="hibernate.show_sql">false</property>
            <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
        </session-factory>
    </hibernate-configuration>
    et essaie le. j'ai mis en rouge ce qui manquait.

  13. #13
    Membre à l'essai
    Inscrit en
    Juillet 2010
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Juillet 2010
    Messages : 20
    Points : 12
    Points
    12
    Par défaut
    J'ai essayé ce bout de code, mais toujours la même erreur fatale

Discussions similaires

  1. Pb de création de fichier de mapping Hibernate
    Par aschraf dans le forum Eclipse Java
    Réponses: 4
    Dernier message: 30/03/2011, 12h38
  2. Réponses: 1
    Dernier message: 27/10/2010, 23h23
  3. pb avec le fichier de mapping hibernate
    Par s.mustapha86 dans le forum Hibernate
    Réponses: 10
    Dernier message: 17/07/2008, 19h21
  4. mettre a jour le fichier de mapping hibernate
    Par solawe dans le forum Hibernate
    Réponses: 3
    Dernier message: 13/12/2006, 21h14
  5. [Hibernate] [Eclipse] Création du fichier de mapping
    Par Willy7901 dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 11/08/2005, 17h54

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