bonjour,

le code suivant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
try {
            //Query query = em.createQuery("select c from cotisation c where c.csgrds=:csgrds and c.csgd=:csgd and c.secu=:secu and c.retraite=:retraite");
            Query query = em.createNativeQuery("select * from cotisation where csgrds='"+ze_csgrds+"' and csgd='"+ze_csgd+"' and secu='"+ze_secu+"' and retraite='"+ze_retraite+"'");
            //query.setParameter("csgrds", ze_csgrds);
            //query.setParameter("csgd", ze_csgd);
            //query.setParameter("secu", ze_secu);
            //query.setParameter("retraite", ze_retraite);
            liste = query.getResultList();
        } catch (Exception e) {
            System.out.println(e.toString());
            throw new PamException("Erreur dans dao/cotisation_dao/create - opération query", 2);
        }
produit une erreur à la ligne liste=query.getResultList();, l'erreur est:

javax.persistence.PersistenceException: org.hibernate.MappingException: No Dialect mapping for JDBC type: 7
savez-vous ce que cela signifie? voici à tout hasard le fichier persistence.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
45
46
47
48
 
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  <!--
  <persistence-unit name="intro_J2EEPU" transaction-type="RESOURCE_LOCAL">
    <class>intro_j2ee.jpa.cotisation</class>
    <class>intro_j2ee.jpa.employé</class>
    <class>intro_j2ee.jpa.indemnité</class>
    <properties>
      <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider"/>
      <property name="" value="diddlepak"/>
    </properties>
  </persistence-unit>
  -->
  <persistence-unit name="intro_J2EEPU" transaction-type="RESOURCE_LOCAL">
 <!-- provider -->
 
 <!--<class>intro_j2ee.jpa.cotisation</class>
    <class>intro_j2ee.jpa.employé</class>
    <class>intro_j2ee.jpa.indemnité</class>-->
 
 <provider>org.hibernate.ejb.HibernatePersistence</provider>
 <properties>
 <!-- Classes persistantes -->
 <property name="hibernate.archive.autodetection" value="class, hbm"/>
 
 <property name="hibernate.show_sql" value="true"/>
 <property name="hibernate.format_sql" value="true"/>
 <property name="use_sql_comments" value="true"/>
 
 <!-- connexion JDBC -->
 <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
 <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/jpa2"/>
 <property name="hibernate.connection.username" value="jpa2"/>
 <property name="hibernate.connection.password" value="jpa2"/>
 <!-- création automatique du schéma -->
 <property name="hibernate.hbm2ddl.auto" value="create"/>
 <!-- Dialecte -->
 <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
 <!-- propriétés DataSource c3p0 -->
 <property name="hibernate.c3p0.min_size" value="5"/>
 <property name="hibernate.c3p0.max_size" value="20"/>
 <property name="hibernate.c3p0.timeout" value="300"/>
 <property name="hibernate.c3p0.max_statements" value="50"/>
 <property name="hibernate.c3p0.idle_test_period" value="3000"/>
 </properties>
 </persistence-unit>
</persistence>

lolveley.