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 execution !


Sujet :

Hibernate Java

  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 253
    Par défaut Hibernate execution !
    slt tout le monde,
    voila j'ai un petit problème, j'ai réalisé une application qui utilise hibernate, mais je n'arrive pas à l'exécuter, j'ai tjrs cette erreur.
    j'utilise NtBeans 6.5
    7 avr. 2009 18:01:35 org.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 3.2.5
    7 avr. 2009 18:01:35 org.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    7 avr. 2009 18:01:35 org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: Bytecode provider name : cglib
    7 avr. 2009 18:01:35 org.hibernate.cfg.Environment <clinit>
    INFO: using JDK 1.4 java.sql.Timestamp handling
    7 avr. 2009 18:01:35 org.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    7 avr. 2009 18:01:35 org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    7 avr. 2009 18:01:36 org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : com/test/rsyncBean/Compte.hbm.xml
    7 avr. 2009 18:01:36 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: com.test.rsyncBean.Compte -> compte
    7 avr. 2009 18:01:36 org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : com/test/rsyncBean/Personne.hbm.xml
    7 avr. 2009 18:01:36 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: com.test.rsyncBean.Personne -> personne
    7 avr. 2009 18:01:36 org.hibernate.cfg.Configuration doConfigure
    INFO: Configured SessionFactory: null
    7 avr. 2009 18:01:36 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Using Hibernate built-in connection pool (not for production use!)
    7 avr. 2009 18:01:36 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Hibernate connection pool size: 1
    7 avr. 2009 18:01:36 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: autocommit mode: false
    7 avr. 2009 18:01:36 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/rsyncdb
    7 avr. 2009 18:01:36 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: connection properties: {user=rsync, password=****}
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: RDBMS: MySQL, version: 5.0.77-community-nt
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )
    7 avr. 2009 18:01:36 org.hibernate.dialect.Dialect <init>
    INFO: Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
    7 avr. 2009 18:01:36 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
    INFO: Using default transaction strategy (direct JDBC transactions)
    7 avr. 2009 18:01:36 org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
    INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic flush during beforeCompletion(): disabled
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Automatic session close at end of transaction: disabled
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch size: 15
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC batch updates for versioned data: disabled
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Scrollable result sets: enabled
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC3 getGeneratedKeys(): enabled
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Connection release mode: auto
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Maximum outer join fetch depth: 2
    7 avr. 2009 18:01:36 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: Default batch fetch size: 1
    Help

    ma classe Personne
    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
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package com.test.rsyncBean;
     
    import com.test.*;
     
    /**
     *
     * @author zenadm
     */
    public class Personne {
     
        private String idPersonne;
        private String perIdPersonne;
        private String nom;
        private String prenom;
        private String email;
        private String tel;
        private Compte compte;
     
     
     
        public Personne(){
     
        }
     
        public String getEmail() {
            return email;
        }
     
        public void setEmail(String email) {
            this.email = email;
        }
     
        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 Compte getCompte() {
            return compte;
        }
     
        public void setCompte(Compte compte) {
            this.compte = compte;
        }
     
    }
    mon fichier mapping hibernate
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
      <class name="com.test.rsyncBean.Personne" table="personne">
        <id column="ID_PERSONNE" name="idPersonne" type="int">
          <generator class="native"/>
        </id>
        <property column="PER_ID_PERSONNE" name="perIdPersonne" not-null="true" type="string"/>
        <property column="NOM" name="nom" not-null="true" type="string"/>
        <property column="PRENOM" name="prenom" not-null="true" type="string"/>
        <property column="EMAIL" name="email" not-null="true" type="date"/>
        <property column="TEL" name="tel" not-null="false" type="double"/>
      </class>
    </hibernate-mapping>
    puis mon fichier conf
    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 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
        <session-factory>
             <!-- SQL dialect -->
            <property name="hibernate.dialect"> org.hibernate.dialect.MySQLInnoDBDialect</property>
        <!-- Database connection settings -->
            <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
            <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/rsyncdb</property>
            <property name="hibernate.connection.username">rsgegrgync</property>
            <property name="hibernate.connection.password">qgrzereqrn4yougrg</property>
         <!-- JDBC connection pool (use the built-in) -->
            <property name="hibernate.connection.pool_size">1</property>
            <!-- Echo all executed SQL to stdout -->
            <property name="hibernate.show_sql">true</property>
            <!-- Enable Hibernate's automatic session context management -->
            <property name="hibernate.current_session_context_class">thread</property>
            <!-- Drop and re-create the database schema on startup -->
            <property name="hibernate.hbm2ddl.auto">create</property>
            <mapping resource="com/test/rsyncBean/Personne.hbm.xml"/>
        </session-factory>
    </hibernate-configuration>
    et pour exécuter tout ça j'utilise le deux classes surventes :
    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
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
     
    package com.test.rsyncModel;
     
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
     
    /**
     *
     * @author zenadm
     */
    //import org.hibernate.*;
    //import org.hibernate.cfg.*;
     
    public class HibernateUtil {
     
        private static final SessionFactory sessionFactory;
     
        static {
            try {
                // Create the SessionFactory from 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;
        }
     
    }
    enfin ma classe main:
    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
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
     
    package com.test.rsyncModel;
     
    import com.test.rsyncBean.Personne;
    import org.hibernate.Session;
     
     
     
     
    public class EventManager {
     
        public static void main(String[] args) {
            EventManager mgr = new EventManager();
     
     
                mgr.getPersonne();
                System.out.println(mgr);
     
     
            HibernateUtil.getSessionFactory().close();
        }
     
        private String getPersonne() {
     
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
     
            session.beginTransaction();
     
            Personne thePersonne = new Personne();
            thePersonne.getNom();
            thePersonne.getPrenom();
     
            session.save(thePersonne);
     
            session.getTransaction().commit();
            return thePersonne.getNom()+thePersonne.getPrenom();
        }
     
    }
    Help!!!!!!!!!!

  2. #2
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    Ou est l'erreur ?

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 253
    Par défaut
    voila mon erreur, on dirait qu'il n'aime pas ma sessionFactory
    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
    Exception in thread "main" java.lang.ExceptionInInitializerError
            at com.test.rsyncModel.HibernateUtil.<clinit>(HibernateUtil.java:30)
            at com.test.rsyncModel.EventManager.getPersonne(EventManager.java:29)
            at com.test.rsyncModel.EventManager.main(EventManager.java:20)
    Caused by: java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(I)V
            at net.sf.cglib.core.DebuggingClassWriter.<init>(DebuggingClassWriter.java:47)
            at net.sf.cglib.core.DefaultGeneratorStrategy.getClassWriter(DefaultGeneratorStrategy.java:30)
            at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:24)
            at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)
            at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:144)
            at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:116)
            at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
            at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
            at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
            at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(CGLIBLazyInitializer.java:117)
            at org.hibernate.proxy.pojo.cglib.CGLIBProxyFactory.postInstantiate(CGLIBProxyFactory.java:43)
            at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:162)
            at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:135)
            at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55)
            at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56)
            at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:295)
            at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434)
            at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:109)
            at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
            at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
            at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
            at com.test.rsyncModel.HibernateUtil.<clinit>(HibernateUtil.java:25)

  4. #4
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    On dirait que tu n'as pas la bonne version de la librairie ASM, à qui il manque une méthode.

  5. #5
    Membre éclairé
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 253
    Par défaut
    On dirait que tu n'as pas la bonne version de la librairie ASM, à qui il manque une méthode
    je n'ai pas bien compris, j'utilise NetBEans 6.5, sais tu comment dois je faire pour avoir la bonne version, sachant que je me rappelle pas que j'ai charger une libraire de ce nom!!!!

  6. #6
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    Essaie de trouver le jar, asm.jar.
    Chez moi, j'ai la version 1.5.3 et j'ai bien la méthode en question.
    Regarde si c'est pareil pour toi.

  7. #7
    Membre éclairé
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 253
    Par défaut
    dans le fichier MANIFEST.MF,
    j'ai les informations suivantes

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.2
    Created-By: 1.5.0_01-b08 (Sun Microsystems Inc.)
    Implementation-Title: ASM
    Implementation-Version: 1.5.3
    Implementation-Vendor: France Telecom R&D

  8. #8
    Membre éclairé
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 253
    Par défaut
    ok, maintenant j'ai cette erreur, quelqu'un a une idée d'où viens?, merci pour votre aide
    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
    9 avr. 2009 14:22:22 org.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 3.3.1.GA
    9 avr. 2009 14:22:22 org.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    9 avr. 2009 14:22:22 org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: Bytecode provider name : javassist
    9 avr. 2009 14:22:22 org.hibernate.cfg.Environment <clinit>
    INFO: using JDK 1.4 java.sql.Timestamp handling
    9 avr. 2009 14:22:22 org.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    9 avr. 2009 14:22:22 org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    9 avr. 2009 14:22:23 org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : HibTest/rsyncBean/Personne.hbm.xml
    9 avr. 2009 14:22:23 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: HibTest.rsyncBean.Personne -> personne
    9 avr. 2009 14:22:23 org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : HibTest/rsyncBean/Compte.hbm.xml
    9 avr. 2009 14:22:23 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: HibTest.rsyncBean.Compte -> compte
    9 avr. 2009 14:22:23 org.hibernate.cfg.Configuration doConfigure
    INFO: Configured SessionFactory: null
    9 avr. 2009 14:22:23 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Using Hibernate built-in connection pool (not for production use!)
    9 avr. 2009 14:22:23 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Hibernate connection pool size: 1
    9 avr. 2009 14:22:23 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: autocommit mode: false
    9 avr. 2009 14:22:23 org.hibernate.connection.DriverManagerConnectionProvider configure
    GRAVE: JDBC Driver class not found: com.mysql.jdbc.Driver
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
            at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:164)
            at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:123)
            at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:84)
            at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)
            at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:79)
            at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:448)
            at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)
            at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
            at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
            at HibTest.rsyncModel.HibernateUtil.<clinit>(HibernateUtil.java:25)
            at HibTest.rsyncModel.EventManager.getPersonne(EventManager.java:30)
            at HibTest.rsyncModel.EventManager.main(EventManager.java:21)
    Initial SessionFactory creation failed.org.hibernate.HibernateException: JDBC Driver class not found: com.mysql.jdbc.Driver
    Exception in thread "main" java.lang.ExceptionInInitializerError

  9. #9
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    Il te manque ton driver Mysql dans ton classpath.

  10. #10
    Membre éclairé
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 253
    Par défaut
    okay je l'ai ajouté, mais ça marche toujours pas

    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
    9 avr. 2009 14:53:58 org.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 3.3.1.GA
    9 avr. 2009 14:53:59 org.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    9 avr. 2009 14:53:59 org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: Bytecode provider name : javassist
    9 avr. 2009 14:53:59 org.hibernate.cfg.Environment <clinit>
    INFO: using JDK 1.4 java.sql.Timestamp handling
    9 avr. 2009 14:53:59 org.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    9 avr. 2009 14:53:59 org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    9 avr. 2009 14:53:59 org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : HibTest/rsyncBean/Personne.hbm.xml
    9 avr. 2009 14:53:59 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: HibTest.rsyncBean.Personne -> personne
    9 avr. 2009 14:53:59 org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : HibTest/rsyncBean/Compte.hbm.xml
    9 avr. 2009 14:53:59 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: HibTest.rsyncBean.Compte -> compte
    9 avr. 2009 14:53:59 org.hibernate.cfg.Configuration doConfigure
    INFO: Configured SessionFactory: null
    9 avr. 2009 14:53:59 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Using Hibernate built-in connection pool (not for production use!)
    9 avr. 2009 14:53:59 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Hibernate connection pool size: 1
    9 avr. 2009 14:53:59 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: autocommit mode: false
    9 avr. 2009 14:53:59 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/rsyncdb
    9 avr. 2009 14:53:59 org.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: connection properties: {user=rsync, password=****}
    9 avr. 2009 14:53:59 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: RDBMS: MySQL, version: 5.0.77-community-nt
    9 avr. 2009 14:53:59 org.hibernate.cfg.SettingsFactory buildSettings
    INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.6 ( Revision: ${svn.Revision} )
    9 avr. 2009 14:53:59 org.hibernate.dialect.Dialect <init>
    INFO: Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
    9 avr. 2009 14:53:59 org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
    INFO: Using default transaction strategy (direct JDBC transactions)

  11. #11
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    En tout cas, il n'y a pas d'erreurs, ou je ne les vois pas.

  12. #12
    Membre éclairé
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 253
    Par défaut
    et tu pense pourquoi ça ne marche pas, par ce que moi je m'attendais à avoir une liste de nom de personnes dans ma table, mais surtout pas quelque chose comme
    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
    INFO: exporting generated schema to database
    9 avr. 2009 14:54:00 org.hibernate.tool.hbm2ddl.SchemaExport create
    GRAVE: Unsuccessful: create table compte (ID_COMPTE varchar(255) not null auto_increment, ID_PERSONNE varchar(255) not null, ID_PROFILE varchar(255) not null, IDENTIFIANT varchar(255) not null, DATE_BAIL datetime not null, QUOTAS double precision not null, SEUIL_AVERTISSEMENT double precision not null, ESPACE_DISK_REST double precision, MODULE_BACKUP varchar(255) not null, ETAT_COMPTE bit not null, primary key (ID_COMPTE)) type=InnoDB
    9 avr. 2009 14:54:00 org.hibernate.tool.hbm2ddl.SchemaExport create
    GRAVE: Incorrect column specifier for column 'ID_COMPTE'
    9 avr. 2009 14:54:00 org.hibernate.tool.hbm2ddl.SchemaExport create
    GRAVE: Unsuccessful: create table personne (ID_PERSONNE varchar(255) not null auto_increment, PER_ID_PERSONNE varchar(255) not null, NOM varchar(255) not null, PRENOM varchar(255) not null, EMAIL varchar(255) not null, TEL varchar(255) not null, primary key (ID_PERSONNE)) type=InnoDB
    9 avr. 2009 14:54:00 org.hibernate.tool.hbm2ddl.SchemaExport create
    GRAVE: Incorrect column specifier for column 'ID_PERSONNE'
    9 avr. 2009 14:54:00 org.hibernate.tool.hbm2ddl.SchemaExport execute
    INFO: schema export complete
    Exception in thread "main" org.hibernate.PropertyValueException: not-null property references a null or transient value: HibTest.rsyncBean.Personne.perIdPersonne
            at org.hibernate.engine.Nullability.checkNullability(Nullability.java:95)
            at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:313)
            at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204)
            at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:130)
            at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
            at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
            at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
            at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
            at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
            at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562)
            at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550)
            at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546)
            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:585)
            at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
            at $Proxy0.save(Unknown Source)
            at HibTest.rsyncModel.EventManager.getPersonne(EventManager.java:38)
            at HibTest.rsyncModel.EventManager.main(EventManager.java:21)

  13. #13
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    Tu n'as pas initialisé la propriété perIdPersonne, qui est obligatoire (not null à true), de ton objet personne dans gerPersonne().

  14. #14
    Membre éclairé
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 253
    Par défaut
    Tu n'as pas initialisé la propriété perIdPersonne, qui est obligatoire (not null à true), de ton objet personne dans gerPersonne().
    je sais pas comment j'instancie un champ, en plus ce n'est pas le seul champ obligatoire. getPersonne est dans cette classe :
    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
     
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
     
    package HibTest.rsyncModel;
     
    import HibTest.rsyncBean.Personne;
    import org.hibernate.Session;
    //import HibTest.rsyncBean.Personne;
     
     
     
     
    public class EventManager {
     
        public static void main(String[] args) {
            EventManager mgr = new EventManager();
     
     
                mgr.getPersonne();
                System.out.println(mgr);
     
     
            HibernateUtil.getSessionFactory().close();
        }
     
        private String getPersonne() {
     
            Session session = HibernateUtil.getSessionFactory().getCurrentSession();
     
            session.beginTransaction();
     
            Personne thePersonne = new Personne();
            thePersonne.getNom();
            thePersonne.getPrenom();
     
            session.save(thePersonne);
     
            session.getTransaction().commit();
            return thePersonne.getNom()+thePersonne.getPrenom();
        }
     
    }
    merci pour ton aide mais j'ai besoin encore que tu me débloque...

  15. #15
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    Personne thePersonne = new Personne();
    thePersonne.getNom();
    thePersonne.getPrenom(); 
    
    thePersonne.set...
    
    session.save(thePersonne);
    Il faut replacer les 3 points par le (ou les) setter de ta classe.

    Je ne voudrais pas être méchant, mais j'ai l'impression que tu recopies des lignes sans essayer de comprendre ce que tu fais.

  16. #16
    Membre éclairé
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    253
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2008
    Messages : 253
    Par défaut
    j'ai ajouté le setter, mais toujours une erreur, on dirait que ça se termine jamais
    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
     
    14 avr. 2009 14:53:42 org.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 3.2.5
    14 avr. 2009 14:53:42 org.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    14 avr. 2009 14:53:42 org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: Bytecode provider name : cglib
    14 avr. 2009 14:53:42 org.hibernate.cfg.Environment <clinit>
    INFO: using JDK 1.4 java.sql.Timestamp handling
    14 avr. 2009 14:53:42 org.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    14 avr. 2009 14:53:42 org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    14 avr. 2009 14:53:42 org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : com/test/rsyncBean/Personne.hbm.xml
    14 avr. 2009 14:53:42 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: com.test.rsyncBean.Personne -> personne
    14 avr. 2009 14:53:42 org.hibernate.cfg.Configuration addResource
    INFO: Reading mappings from resource : com/test/rsyncBean/Compte.hbm.xml
    14 avr. 2009 14:53:42 org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
    INFO: Mapping class: com.test.rsyncBean.Compte -> compte
    14 avr. 2009 14:53:42 org.hibernate.cfg.Configuration doConfigure
    INFO: Configured SessionFactory: null
    Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: String, for columns: [org.hibernate.mapping.Column(PASSWORD)]
    Exception in thread "main" java.lang.ExceptionInInitializerError
            at com.test.rsyncModel.HibernateUtil.<clinit>(HibernateUtil.java:30)
            at com.test.rsyncModel.EventManager.getPersonne(EventManager.java:29)
            at com.test.rsyncModel.EventManager.main(EventManager.java:20)
    Caused by: org.hibernate.MappingException: Could not determine type for: String, for columns: [org.hibernate.mapping.Column(PASSWORD)]
            at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)

Discussions similaires

  1. Probleme Hibernate :Execution du commit
    Par lok9001 dans le forum Hibernate
    Réponses: 11
    Dernier message: 04/06/2008, 14h36
  2. erreur hibernate lors de l'execution
    Par ouatmad dans le forum Hibernate
    Réponses: 4
    Dernier message: 21/01/2008, 19h08
  3. [Hibernate][error] Could not execute JDBC batch update
    Par CPI_en_mousse dans le forum Hibernate
    Réponses: 7
    Dernier message: 01/06/2007, 09h41
  4. Réponses: 4
    Dernier message: 11/04/2007, 11h15
  5. Eclipse-Hibernate-erreur Execution
    Par Invité dans le forum Hibernate
    Réponses: 18
    Dernier message: 22/06/2006, 09h37

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