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 :

ok avec hibernate 4, erreur avec le 5


Sujet :

Hibernate Java

  1. #1
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

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

    Informations forums :
    Inscription : Octobre 2014
    Messages : 176
    Points : 198
    Points
    198
    Par défaut ok avec hibernate 4, erreur avec le 5
    Bonsoir,
    Voilà comme je le dis dans l'intitulé, je fais une petite application web, maven hibernate...
    Dans mon pom.xml quand je met la dependance : hibernate-core 5.0.6 ça ne fonctionne pas
    mais si je mets la 4.x.x ça fonctionne, d'où peut venir ce problème?
    je developpe sur:
    - eclipse neon
    -linux
    -java ee7
    l'erreur que j'ai avec hibernate 5, c'est: ...mapping exception, unknown entity ...
    Après la difficulté, la facilité...

  2. #2
    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
    ben déjà tu nous donne l'erreur complète, ton loggue et le code concerné?

    Il y a beaucoup d'ambiguïtés qui ont été fixées d'une version à l'autre d'hibernate. Changer de version ne marche que si le mapping était tiptop, mais on fait souvent des erreurs qui passent au bleu avec une version mais font tout péter avec une autre.

  3. #3
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

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

    Informations forums :
    Inscription : Octobre 2014
    Messages : 176
    Points : 198
    Points
    198
    Par défaut
    désolé...et mon erreur à mutée
    J'explique : le but est un formulaire d'inscription qui verifie si le client est déja en base de données mysql.

    partie de mon objet metier qui valide si l'email est deja en base ou si il est incorrecte dans la synthaxe
    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
     
          CustomerService customerService = new CustomerService();
            .
            .
            .
            try 
            {
                validateEmail(email);
            }
            catch (Exception e)
            {
                setErrors( EMAIL_ATT, e.getMessage() );
            }
            Customer.setEmail( email );
           .
           .
           . 
     
           private void validateEmail( String email ) throws Exception {
     
            String emailToFind = (customerService.findByEmail( email )).getEmail();
            System.out.println( "email retrieved : " + emailToFind );
            String regex = "([^.@]+)(\\.[^.@]+)*@([^.@]+\\.)+([^.@]+)";
            if (email != null )
            {
               if(!email.matches( regex ))
               {
                   throw new Exception("Please enter a valid email");
               }
               else if(email.equals(emailToFind))
               {
                   throw new Exception ("Please enter another email!!!");
               }
            }
            else
            {
                throw new Exception("Please enter an email");
            }
     
        }

    partie de ma classe CustomerService qui cherche dans la base si un email existe deja et retourne l'objet si oui, sinon un objet vide
    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
      private static CustomerDao = new CustomerDao();
          .
          . 
          .
      public Customer findByEmail(String email)
        {
           Customer customer;
            List<Customer> customers = findAll();
            Iterator itr = customers.iterator();
            while(itr.hasNext()) {
                customer = (Customer) itr.next();
     
              if(customer.getEmail().equals( email ))
              {             
                  return customer;            
              }        
            }        
            return new Customer();  
         } 
     
     
       public List<Customer> findAll() {
            customerDao.openCurrentSession();
            List<Customer> customers = customerDao.findAll();
            customerDao.closeCurrentSession();
            return customers;
        }  
        }
    partie du code de ma dao recherchant tous les objet "customer"

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     @SuppressWarnings("unchecked")
            public List<Customer > findAll() {
                List<Customer > customers  = (List<Customer>) getCurrentSession().createQuery("from Customer").list();
                return customers;
            }
    je me retrouve avec cela
    Nom : Screenshot from 2015-12-24 16:13:40.png
Affichages : 143
Taille : 5,1 Ko

    sachant que normalement a la place de "Customer is not mapped [from Customer] je devrais rien avoir car ma jsp devrait afficher la valeur d'une map d'erreur genre:
    email pas valid, ou email deja pris...
    Au pire je reprends la version 4 d hibernate et des que mon projet est fini je verrai pour integré la 5, merci
    Après la difficulté, la facilité...

  4. #4
    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
    Ce message dit simplement que Hibernate ne connait pas la classe Customer, qu'elle ne fait pas partie de ses entités. Comment est configuré ton Hibernate? Annotations? fichier config? Quelles sont les messages d'hibernate lors de la création de la factory? La console de log de ton serveur?


    Et au passage, même si cela n'a rien à voir avec ton problème:

    ta regexp validant l'email est erronée (elle refuse des adresses tordues mais valides)
    • ([^.@]+)(\\.[^.@]+)* -> je peux très bien avoir comme email tchize....is...best@maboite.com ou même avoir un @ dans mon user "@twitter"@maboite.com
    • @([^.@]+\\.)+([^.@]+) -> user@com est une adresse valide mais tu la refuse.




    Il est ridicule de charger tous les customers pour voir si l'adresse est déjà prise. Fait simplement un select sur l'adresse mail et regarde si le résultat est vide:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
            public List<Customer > findByEmail(String email) {
                List<Customer > customers  = (List<Customer>) getCurrentSession().createQuery("from Customer c where c.email=:e").setParameter("e",email).list();
                return customers;
            }

  5. #5
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

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

    Informations forums :
    Inscription : Octobre 2014
    Messages : 176
    Points : 198
    Points
    198
    Par défaut
    Voillà mes fichiers de config
    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
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-configuration SYSTEM 
    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
     
    <hibernate-configuration>
       <session-factory>
       <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
       <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
       <property name="hibernate.connection.url">jdbc:mysql://localhost/moneyTime</property>
       <property name="hibernate.connection.username">abysr</property>
       <property name="hibernate.connection.password">1234</property>
       <property name="connection.pool_size">1</property>
       <property name="hibernate.hbm2ddl.auto">update</property>
       <property name="show_sql">true</property>
       <property name="hibernate.current_session_context_class">thread</property>
       <mapping class="com.abysr.moneytime.model.Customer"/>
    </session-factory>
    </hibernate-configuration>
    pom.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
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.abysr.nfe102</groupId>
      <artifactId>MoneyTime</artifactId>
      <packaging>war</packaging>
      <version>0.0.1-SNAPSHOT</version>
      <name>MoneyTime Maven Webapp</name>
      <url>http://maven.apache.org</url>
      <build>
        <finalName>MoneyTime</finalName>
      </build>
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>
      <dependencies>
      	<dependency>
      		<groupId>jstl</groupId>
      		<artifactId>jstl</artifactId>
      		<version>1.2</version>
      	</dependency>  
      	<dependency>
      		<groupId>javax.servlet</groupId>
      		<artifactId>servlet-api</artifactId>
      		<version>2.5</version>
      	</dependency>
     
      	<dependency>
      		<groupId>mysql</groupId>
      		<artifactId>mysql-connector-java</artifactId>
      		<version>5.1.38</version>
      	</dependency>
      	<dependency>
      		<groupId>javax.transaction</groupId>
      		<artifactId>jta</artifactId>
      		<version>1.1</version>
      	</dependency>
      	<dependency>
      		<groupId>org.hibernate</groupId>
      		<artifactId>hibernate-core</artifactId>
      		<version>4.3.6.Final</version>
      	</dependency>
      </dependencies>
    </project>
    et ma classe Customer
    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
    package com.abysr.moneytime.model;
     
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.Table;
     
    @Entity
    @Table(name="CUSTOMER")
    public class Customer {
     
        @Id
        @GeneratedValue
        @Column(name="id_customer")
        private Long id; 
     
        @Column(name="email_customer")
        private String email;
     
        @Column(name="password_customer")
        private String password;
     
        @Column(name="account_customer")
        private Integer account;
     
        public Customer()
        {
            this.account = 16;
        }
     
     
     
        public Long getId() {
            return id;
        }
        public void setId( Long id ) {
            this.id = id;
        }
        public String getEmail() {
            return email;
        }
        public void setEmail( String email ) {
            this.email = email;
        }
        public String getPassword() {
            return password;
        }
        public void setPassword( String password ) {
            this.password = password;
        }
        public Integer getAccount() {
            return account;
        }
        public void setAccount( Integer account ) {
            this.account = account;
            }
    }
    Pour ce qui est de ma methode findByEmail(String email)
    je la garde car elle me permet de me retourné un objet customer quand j'ai besoin de faire le lien avec l'email et le mot de passe pour m'assurer qu'il s'agit du bon "customer".
    Si il y a une meilleur façon de faire bien entendu, je suis preneur
    @ plus
    Après la difficulté, la facilité...

  6. #6
    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
    Manque le plus important, les logs.


    Je e vois pas le rapport entre le fait d'avoir besoin d'un Customer et le faire de parcourir en boucle tous les Customer.

  7. #7
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

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

    Informations forums :
    Inscription : Octobre 2014
    Messages : 176
    Points : 198
    Points
    198
    Par défaut
    Voici les logs, mais bon là ca marche assez bien

    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
    Dec 25, 2015 7:48:02 AM org.apache.jasper.servlet.TldScanner scanJars
    INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    Dec 25, 2015 7:48:02 AM org.apache.catalina.core.StandardContext reload
    INFO: Reloading Context with name [/MoneyTime] is completed
    Dec 25, 2015 8:00:33 AM org.apache.catalina.core.StandardContext reload
    INFO: Reloading Context with name [/MoneyTime] has started
    Dec 25, 2015 8:00:33 AM org.apache.jasper.servlet.TldScanner scanJars
    INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
    Dec 25, 2015 8:00:33 AM org.apache.catalina.core.StandardContext reload
    INFO: Reloading Context with name [/MoneyTime] is completed
    Get method called
    Dec 25, 2015 8:03:11 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
    INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
    Dec 25, 2015 8:03:11 AM org.hibernate.Version logVersion
    INFO: HHH000412: Hibernate Core {4.3.6.Final}
    Dec 25, 2015 8:03:11 AM org.hibernate.cfg.Environment <clinit>
    INFO: HHH000206: hibernate.properties not found
    Dec 25, 2015 8:03:11 AM org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: HHH000021: Bytecode provider name : javassist
    Dec 25, 2015 8:03:11 AM org.hibernate.cfg.Configuration configure
    INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
    Dec 25, 2015 8:03:11 AM org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
    Dec 25, 2015 8:03:11 AM org.hibernate.cfg.Configuration doConfigure
    INFO: HHH000041: Configured SessionFactory: null
    Dec 25, 2015 8:03:11 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)
    Dec 25, 2015 8:03:11 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/moneyTime]
    Dec 25, 2015 8:03:11 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH000046: Connection properties: {user=abysr, password=****}
    Dec 25, 2015 8:03:11 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH000006: Autocommit mode: false
    Dec 25, 2015 8:03:11 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    INFO: HHH000115: Hibernate connection pool size: 1 (min=1)
    Dec 25, 2015 8:03:12 AM org.hibernate.dialect.Dialect <init>
    INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
    Dec 25, 2015 8:03:12 AM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
    INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
    Dec 25, 2015 8:03:12 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
    INFO: HHH000397: Using ASTQueryTranslatorFactory
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000228: Running hbm2ddl schema update
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000102: Fetching database metadata
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000396: Updating schema
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: HHH000261: Table found: moneyTime.CUSTOMER
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: HHH000037: Columns: [id_customer, account_customer, password_customer, email_customer]
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: HHH000108: Foreign keys: []
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: HHH000126: Indexes: [email_customer, primary]
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000232: Schema update complete
    email retrieved : null
    Dec 25, 2015 8:03:12 AM org.hibernate.cfg.Configuration configure
    INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
    Dec 25, 2015 8:03:12 AM org.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
    Dec 25, 2015 8:03:12 AM org.hibernate.cfg.Configuration doConfigure
    INFO: HHH000041: Configured SessionFactory: null
    Dec 25, 2015 8:03:12 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)
    Dec 25, 2015 8:03:12 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/moneyTime]
    Dec 25, 2015 8:03:12 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH000046: Connection properties: {user=abysr, password=****}
    Dec 25, 2015 8:03:12 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH000006: Autocommit mode: false
    Dec 25, 2015 8:03:12 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    INFO: HHH000115: Hibernate connection pool size: 1 (min=1)
    Dec 25, 2015 8:03:12 AM org.hibernate.dialect.Dialect <init>
    INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
    Dec 25, 2015 8:03:12 AM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
    INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
    Dec 25, 2015 8:03:12 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
    INFO: HHH000397: Using ASTQueryTranslatorFactory
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000228: Running hbm2ddl schema update
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000102: Fetching database metadata
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000396: Updating schema
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: HHH000261: Table found: moneyTime.CUSTOMER
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: HHH000037: Columns: [id_customer, account_customer, password_customer, email_customer]
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: HHH000108: Foreign keys: []
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.TableMetadata <init>
    INFO: HHH000126: Indexes: [email_customer, primary]
    Dec 25, 2015 8:03:12 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000232: Schema update complete
    Successfull inscription true

    Pour ce qui est de parcourir tous les Customer, c'est clair, et vu qu'il ne peut pas y avaoir en base deux email identiques.
    Est il possible de recuperer un seul Customer? ( je sais, je devis du sujet original...)
    Après la difficulté, la facilité...

  8. #8
    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
    Ce sont les logs avec Hibernate5, quand "ça ne fonctionne pas" qui m'intéressent

  9. #9
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

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

    Informations forums :
    Inscription : Octobre 2014
    Messages : 176
    Points : 198
    Points
    198
    Par défaut
    dac

    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
    Get method called
    Dec 25, 2015 9:28:37 AM org.hibernate.Version logVersion
    INFO: HHH000412: Hibernate Core {5.0.6.Final}
    Dec 25, 2015 9:28:37 AM org.hibernate.cfg.Environment <clinit>
    INFO: HHH000206: hibernate.properties not found
    Dec 25, 2015 9:28:37 AM org.hibernate.cfg.Environment buildBytecodeProvider
    INFO: HHH000021: Bytecode provider name : javassist
    Dec 25, 2015 9:28:37 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>
    INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
    Dec 25, 2015 9:28:37 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
    WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
    Dec 25, 2015 9:28:37 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH10001005: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost/moneyTime]
    Dec 25, 2015 9:28:37 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH10001001: Connection properties: {user=abysr, password=****}
    Dec 25, 2015 9:28:37 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
    INFO: HHH10001003: Autocommit mode: false
    Dec 25, 2015 9:28:37 AM org.hibernate.engine.jdbc.connections.internal.PooledConnections <init>
    INFO: HHH000115: Hibernate connection pool size: 1 (min=1)
    Dec 25, 2015 9:28:37 AM org.hibernate.dialect.Dialect <init>
    INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
    Dec 25, 2015 9:28:38 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute
    INFO: HHH000228: Running hbm2ddl schema update
    Dec 25, 2015 9:28:38 AM org.hibernate.hql.internal.QueryTranslatorFactoryInitiator initiateService
    INFO: HHH000397: Using ASTQueryTranslatorFactory
    Après la difficulté, la facilité...

  10. #10
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

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

    Informations forums :
    Inscription : Octobre 2014
    Messages : 176
    Points : 198
    Points
    198
    Par défaut
    J'ai trouvé une partie de l'erreur


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
            public CustomerDao() {
                Configuration configuration = new Configuration().configure();
                StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()
                        .applySettings(configuration.getProperties());
             sessionFactory = configuration.buildSessionFactory(builder.build());
                
            }
    j'ai remplacé par :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
            public CustomerDao() {
                Configuration configuration = new Configuration().configure();
     
             sessionFactory = configuration.buildSessionFactory();
     
            }
    Comme si il y avait un conflit de configuration en fait
    Après la difficulté, la facilité...

  11. #11
    Membre habitué
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Octobre 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

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

    Informations forums :
    Inscription : Octobre 2014
    Messages : 176
    Points : 198
    Points
    198
    Par défaut
    En effet le probleme etait que suivant la version d'hibernate la config se fait differrement.
    Après la difficulté, la facilité...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [MyEclipse] Erreurs avec Hibernate
    Par Linos1003 dans le forum Eclipse
    Réponses: 1
    Dernier message: 09/02/2012, 22h58
  2. Erreur avec Hibernate dans les logs tomcat
    Par sylviefrfr dans le forum Hibernate
    Réponses: 4
    Dernier message: 15/12/2010, 19h47
  3. Message erreur avec Hibernate
    Par wassimbik dans le forum Hibernate
    Réponses: 1
    Dernier message: 28/07/2010, 12h40
  4. [Data] Erreur avec HIBERNATE
    Par top_eagle dans le forum Spring
    Réponses: 4
    Dernier message: 23/10/2009, 14h28
  5. EJB 3.0 vs Hibernate ??? EJB 3.0 avec Hibernate ???
    Par yakamax dans le forum Hibernate
    Réponses: 2
    Dernier message: 11/04/2006, 12h31

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