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 :

Problème avec hibernate


Sujet :

Hibernate Java

  1. #1
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut Problème avec hibernate
    Bonjour, je développe une petite appli où j'utilise Hibernate pour le mapping ORM. J'ai une erreur donc j'arrive pas à trouver la source.
    voici les erreurs que j'ai dans la console:

    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
     
    mars 24, 2016 11:04:27 PM org.hibernate.annotations.common.Version <clinit>
    INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
    mars 24, 2016 11:04:27 PM org.hibernate.Version logVersion
    INFO: HHH000412: Hibernate Core {4.2.21.Final}
    mars 24, 2016 11:04:27 PM org.hibernate.cfg.Environment <clinit>
    INFO: HHH000206: hibernate.properties not found
    mars 24, 2016 11:04:27 PM org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: HHH000021: Bytecode provider name : javassist
    mars 24, 2016 11:04:27 PM org.hibernate.cfg.Configuration configure
    INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
    mars 24, 2016 11:04:27 PM org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
    mars 24, 2016 11:04:27 PM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
    WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
    mars 24, 2016 11:04:28 PM org.hibernate.cfg.Configuration doConfigure
    INFO: HHH000041: Configured SessionFactory: null
    mars 24, 2016 11:04:28 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)
    mars 24, 2016 11:04:28 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    INFO: HHH000115: Hibernate connection pool size: 20
    mars 24, 2016 11:04:28 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    INFO: HHH000006: Autocommit mode: false
    mars 24, 2016 11:04:28 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/catalogue]
    mars 24, 2016 11:04:28 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    INFO: HHH000046: Connection properties: {user=root, hbm2ddl.auto=create, password=****}
    mars 24, 2016 11:04:28 PM org.hibernate.dialect.Dialect <init>
    INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
    mars 24, 2016 11:04:28 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
    INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
    mars 24, 2016 11:04:28 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
    INFO: HHH000397: Using ASTQueryTranslatorFactory
    Hibernate: insert into PRODUITS (DESIGNATION, prix, quantite) values (?, ?, ?)
    mars 24, 2016 11:04:29 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
    WARN: SQL Error: 1146, SQLState: 42S02
    mars 24, 2016 11:04:29 PM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
    ERROR: Table 'catalogue.PRODUITS' doesn't exist
    org.hibernate.exception.SQLGrammarException: could not execute statement
    	at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:82)
    	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
    	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)
    	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
    	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)
    	at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:96)
    	at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:58)
    	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2987)
    	at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3499)
    	at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:81)
    	at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)
    	at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:229)
    	at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:209)
    	at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:193)
    	at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:321)
    	at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:286)
    	at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:192)
    	at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125)
    	at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:206)
    	at org.hibernate.event.internal.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:55)
    	at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:191)
    	at org.hibernate.event.internal.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:49)
    	at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90)
    	at org.hibernate.internal.SessionImpl.fireSave(SessionImpl.java:683)
    	at org.hibernate.internal.SessionImpl.save(SessionImpl.java:675)
    	at org.hibernate.internal.SessionImpl.save(SessionImpl.java:671)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:497)
    	at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:352)
    	at com.sun.proxy.$Proxy7.save(Unknown Source)
    	at org.metier.CatalogueMetierImpl.addProduit(CatalogueMetierImpl.java:17)
    	at org.metier.TestMetier.main(TestMetier.java:8)
    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'catalogue.PRODUITS' doesn't exist
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
    	at com.mysql.jdbc.Util.getInstance(Util.java:387)
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
    	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)
    	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)
    	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2551)
    	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
    	at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2073)
    	at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2009)
    	at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5094)
    	at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1994)
    	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)
    	... 29 more
    Exception in thread "main" org.hibernate.SessionException: Session is closed!
    	at org.hibernate.internal.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:130)
    	at org.hibernate.internal.SessionImpl.getTransaction(SessionImpl.java:1380)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:497)
    	at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:352)
    	at com.sun.proxy.$Proxy7.getTransaction(Unknown Source)
    	at org.metier.CatalogueMetierImpl.addProduit(CatalogueMetierImpl.java:22)
    	at org.metier.TestMetier.main(TestMetier.java:8)
    mon fichier 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
     
    <?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">com.mysql.jdbc.Driver</property>
            <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/catalogue</property>
            <property name="hibernate.connection.username">root</property>
            <property name="hibernate.connection.password"></property>
            <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
            <property name="hibernate.show_sql">true</property>
            <property name="hibernate.connection.hbm2ddl.auto">create</property>
            <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
            <property name="hibernate.current_session_context_class">thread</property>
            <mapping class="org.metier.Produit"/>
        </session-factory>
    </hibernate-configuration>
    Ma classe comprenant les méthodes hibernate-jpa

    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
     
    package org.metier;
     
    import java.util.List;
     
    import org.hibernate.Query;
    import org.hibernate.Session;
     
    import util.HibernateUtil;
     
    public class CatalogueMetierImpl implements ICatalogueMetier {
     
        @Override
        public void addProduit( Produit p ) {
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            session.beginTransaction();
            try {
                session.save( p );
            } catch ( Exception e ) {
                session.getTransaction().rollback();
                e.printStackTrace();
            }
            session.getTransaction().commit();
        }
     
        @Override
        public List<Produit> listProduit() {
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            session.beginTransaction();
            Query req = session.createSQLQuery( "select p from Produit p" );
            List<Produit> prods = req.list();
            session.getTransaction().commit();
            return prods;
        }
     
        @Override
        public Produit getProduit( Long idProd ) {
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            session.beginTransaction();
            Object p = session.get( Produit.class, idProd );
            if ( p == null )
                throw new RuntimeException( "Produit introuvable" );
            session.getTransaction().commit();
            return (Produit) p;
        }
     
        @Override
        public List<Produit> getProduitParMc( String mc ) {
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            session.beginTransaction();
            Query req = session.createSQLQuery( "select p from Produit p where p.designation like :x" );
            req.setParameter( "x", "%" + mc + "%" );
            List<Produit> prods = req.list();
            session.getTransaction().commit();
            return prods;
        }
     
        @Override
        public void deleteProduit( Long idProd ) {
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            session.beginTransaction();
            Object p = session.get( Produit.class, idProd );
            if ( p == null )
                throw new RuntimeException( "Produit introuvable" );
            session.delete( p );
            session.getTransaction().commit();
        }
     
        @Override
        public void updateProduit( Produit p ) {
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
            session.beginTransaction();
            session.update( p );
            session.getTransaction().commit();
     
        }
     
    }
    Merci de votre aide

  2. #2
    Membre confirmé Avatar de freddou17
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2013
    Messages
    341
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2013
    Messages : 341
    Points : 566
    Points
    566
    Par défaut
    Slt,
    Pouvons nous voir le mapping de tes tables?

    ++
    "Aucun de nous ne sait ce que nous savons tous, ensemble."
    Lien vers mon appli Funcash n'hésitez pas à donner votre avis

  3. #3
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut
    oui bien sûr,
    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
     
    package org.metier;
     
    import java.io.Serializable;
     
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.Table;
     
    @Entity
    @Table( name = "PRODUITS" )
    public class Produit implements Serializable {
     
        @Id
        @GeneratedValue( strategy = GenerationType.IDENTITY )
        @Column( name = "ID_PRODUIT" )
        private Long   idProduit;
        @Column( name = "DESIGNATION" )
        private String designation;
        private double prix;
        private int    quantite;
     
        public Produit() {
            super();
            // TODO Auto-generated constructor stub
        }
     
        public Produit( String designation, double prix, int quantite ) {
            super();
            this.designation = designation;
            this.prix = prix;
            this.quantite = quantite;
        }

  4. #4
    Membre confirmé Avatar de freddou17
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2013
    Messages
    341
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2013
    Messages : 341
    Points : 566
    Points
    566
    Par défaut
    Slt,

    Il y a cette erreur 'Table 'catalogue.PRODUITS' doesn't exist', es tu sur qu'il n'y a pas d'erreur dans le nom?
    Tu es dans un package de test ?

    Autre point vu que tu es sur mysql, je pense que ta propriété :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     <property name="hibernate.connection.hbm2ddl.auto">create</property>
    devrait être:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     <property name="hibernate.connection.hbm2ddl.auto">update</property>

    ++
    "Aucun de nous ne sait ce que nous savons tous, ensemble."
    Lien vers mon appli Funcash n'hésitez pas à donner votre avis

  5. #5
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut
    J'avais déjà corrigé le nom de la table.
    La valeur "create" pour cette propriété permet degénérer les tables tandis que "update" permet de les mettre à jour lorsqu'elles existent déjà donc je pense pas que ce soit la source du problème.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
     <property name="hibernate.connection.hbm2ddl.auto">create</property>
    Je ne suis pas dans le package de test.
    L'erreur après connexion du nom de la table est donc la suivante:
    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
     
    mars 30, 2016 10:14:15 AM org.hibernate.Version logVersion
    INFO: HHH000412: Hibernate Core {5.1.0.Final}
    mars 30, 2016 10:14:15 AM org.hibernate.cfg.Environment <clinit>
    INFO: HHH000206: hibernate.properties not found
    mars 30, 2016 10:14:15 AM org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: HHH000021: Bytecode provider name : javassist
    mars 30, 2016 10:14:15 AM org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver resolveEntity
    WARN: HHH90000012: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/hibernate-configuration. Use namespace http://www.hibernate.org/dtd/hibernate-configuration instead.  Support for obsolete DTD/XSD namespaces may be removed at any time.
    mars 30, 2016 10:14:15 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
    INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
    mars 30, 2016 10:14:16 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
    mars 30, 2016 10:14:16 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/catalogue]
    mars 30, 2016 10:14:16 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH10001001: Connection properties: {user=fnjiokou, hbm2ddl.auto=create, password=****}
    mars 30, 2016 10:14:16 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH10001003: Autocommit mode: false
    mars 30, 2016 10:14:16 AM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
    INFO: HHH000115: Hibernate connection pool size: 20 (min=1)
    mars 30, 2016 10:14:16 AM org.hibernate.dialect.Dialect <init>
    INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
    Initial SessionFactory creation failed.java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
    Exception in thread "main" java.lang.ExceptionInInitializerError
    	at util.HibernateUtil.<clinit>(HibernateUtil.java:16)
    	at org.metier.CatalogueMetierImpl.addProduit(CatalogueMetierImpl.java:14)
    	at org.metier.TestMetier.main(TestMetier.java:8)
    Caused by: java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
    	at org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions(EntityBinder.java:1087)
    	at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:767)
    	at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:245)
    	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:222)
    	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
    	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
    	at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
    	at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
    	at util.HibernateUtil.<clinit>(HibernateUtil.java:12)
    	... 2 more

  6. #6
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    salut,
    tu sembles avoir 2 versions differentes d´hibernate-jpa-api dans ta classpath.
    regardes voir et donnes nous la liste des Jars qui sont dans ta classpath.

    Eric

  7. #7
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut
    J'ai eu à rajouter 1 ou 2 jar pour essayer de résoudre le problème effectivement.
    Nom : liste_jar.png
Affichages : 1484
Taille : 28,5 Ko

  8. #8
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    salut,
    enleves
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    hibernate-entitymanager-5.1.0XXX
    Eric

  9. #9
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut
    Je l'ai enlevé mais l'erreur persiste. j'ai exactement le même message.

  10. #10
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    salut,
    il faut faire un nettoyage de ton projet, mettre a la place de gerimo-jta, simplement et reessayer.

    Eric

  11. #11
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut
    qu'entends tu par nettoyer mon projet? c'est un projet web dynamique!

  12. #12
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    project --> clean

  13. #13
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut
    Malheureusement, toujours pas de changement.

  14. #14
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    essaies de les enlever une par une et voir si cela change quelque chose.
    eric

  15. #15
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut
    Il ne se passe pas grand chose, des erreurs changent selon je jar que je retire.
    Personnellement j'ai comme l'impression que c'es cette ligne le problème
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    INFO: HHH000206: hibernate.properties not found
    En cherchant sur internet, il paraît que ça pourrait venir de ma classe: "HibernateUtil.java".

  16. #16
    Membre confirmé Avatar de freddou17
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2013
    Messages
    341
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2013
    Messages : 341
    Points : 566
    Points
    566
    Par défaut
    tu as besoin de hibernate tools?

    dans les required d'hibernate 5.1.0 on a :
    - antlr-2.7.7.jar
    - jboss-logging-3.3.0.Final.jar
    -hibernate-jpa-2.1-api-1.0.0.Final.jar
    -javassist-3.20.0-GA.jar
    -geronimo-jta_1.1_spec-1.1.1.jar
    -jandex-2.0.0.Final.jar
    -classmate-1.3.0.jar
    -dom4j-1.6.1.jar
    -hibernate-commons-annotations-5.0.1.Final.jar
    -hibernate-core-5.1.0.Final.jar

    Peux tu nous montrer ton HibernateUtils stp?
    ++
    "Aucun de nous ne sait ce que nous savons tous, ensemble."
    Lien vers mon appli Funcash n'hésitez pas à donner votre avis

  17. #17
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut
    Je n'ai plus d'hibernate tools. j'ai exactement les jar required et mysql-connector!
    Mon HibernateUtil:
    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
     
    package util;
     
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
     
    public class HibernateUtil {
        public static final SessionFactory sessionFactory;
     
        static {
            try {
                // Création de la SessionFactory à partir de hibernate.cfg.xml
                sessionFactory = new Configuration().configure().buildSessionFactory();
            } catch ( Throwable ex ) {
                // Make sure you log the exception, as it might be swallowed
                System.err.println( "Initial SessionFactory creation failed." + ex );
                throw new ExceptionInInitializerError( ex );
            }
        }
     
        public static SessionFactory getSessionFactory() {
            return sessionFactory;
        }
    }
    En plus dans mes logs j'ai ces deux lignes aussi
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    Initial SessionFactory creation failed.java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index;
    Exception in thread "main" java.lang.ExceptionInInitializerError

  18. #18
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
            <property name="hibernate.connection.hbm2ddl.auto">create</property>
    La propriété correcte c'est hibernate.hbm2ddl.auto pas hibernate.connection.hbm2ddl.auto. Comme on le vois dans tes logs, hibernate ne crée pas les tables.

  19. #19
    Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    145
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 34
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2015
    Messages : 145
    Points : 62
    Points
    62
    Par défaut
    Même problème.

  20. #20
    Membre confirmé Avatar de freddou17
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2013
    Messages
    341
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2013
    Messages : 341
    Points : 566
    Points
    566
    Par défaut
    salut,
    peux tu essayer de construire ta sessionFactory comme l'exemple ci-dessous:

    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
     
    private static SessionFactory sessionFactory;
     
        public static SessionFactory getSessionFactory() {
            if (sessionFactory == null) {
                // loads configuration and mappings
                Configuration configuration = new Configuration().configure();
                ServiceRegistry serviceRegistry
                    = new StandardServiceRegistryBuilder()
                        .applySettings(configuration.getProperties()).build();
     
                // builds a session factory from the service registry
                sessionFactory = configuration.buildSessionFactory(serviceRegistry);           
            }
     
            return sessionFactory;
    ++
    "Aucun de nous ne sait ce que nous savons tous, ensemble."
    Lien vers mon appli Funcash n'hésitez pas à donner votre avis

Discussions similaires

  1. Problème avec hibernate et MySQL!
    Par sofien dans le forum Outils
    Réponses: 5
    Dernier message: 27/08/2008, 09h06
  2. Les problémes avec Hibernate
    Par hichem_enis dans le forum Struts 1
    Réponses: 7
    Dernier message: 11/04/2008, 13h00
  3. Problème avec Hibernate
    Par ISID dans le forum Hibernate
    Réponses: 13
    Dernier message: 05/10/2007, 12h27
  4. Problème avec Hibernate synchronizer
    Par jason69 dans le forum Hibernate
    Réponses: 2
    Dernier message: 27/08/2007, 11h35
  5. [Hibernate] Problème avec Hibernate et Eclipse 3
    Par theseuby dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 30/03/2006, 21h31

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