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 :

syntaxe sur requete


Sujet :

Hibernate Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Juin 2009
    Messages
    51
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 51
    Par défaut syntaxe sur requete
    Bonjour,

    je débute avec Hibernate, et je rencontre un problème à l'execution de mon projet.

    Mon fichier Test.java dans le package par défaut est le suivant :
    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
     
    import java.util.*;
    import net.sf.hibernate.*;
    import com.hibernate.*;
     
    public class Test {
     
     public static void main(String[] args)	throws HibernateException {
    	 Session session = HibernateUtil.currentSession();;
    	 //Transaction tx = session.beginTransaction();
    	 //Query requette = session.createQuery("FROM Fwexemple");
    	 //List list = requette.list();
    	 Iterator list = session.createSQLQuery("select *  FROM Fwexemple","Fwexemple",Fwexemple.class).list().listIterator();
    	 while(list.hasNext())
    	 {
    		 Fwexemple user = (Fwexemple)list.next();
    	   System.out.println(user.toString());
    	 }
     
    	 HibernateUtil.closeSession();
     
     }
    }
    Ensuite le fichier Fwexemple.java contient :

    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
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
     
    package com.hibernate;
     
    import java.io.Serializable;
    import net.sf.hibernate.PersistentEnum;
     
    /**
     * This class has been automatically generated by Hibernate Synchronizer.
     * For more information or documentation, visit The Hibernate Synchronizer page
     * at http://www.binamics.com/hibernatesync or contact Joe Hudson at joe@binamics.com.
     */
    @SuppressWarnings("deprecation")
    public class Fwexemple implements Serializable, PersistentEnum {
     
    	/**
             * 
             */
    	private static final long serialVersionUID = 6137497370677628315L;
    	public static final Fwexemple WEB_USER = new Fwexemple(69);
    	public static final Fwexemple PROFIL_C_O_M = new Fwexemple(64);
    	public static final Fwexemple EQUIPE_DÉVELOPPEMENT = new Fwexemple(65);
    	public static final Fwexemple DEMO_USER = new Fwexemple(200);
    	public static final Fwexemple PROFIL_D_E_V1 = new Fwexemple(66);
    	public static final Fwexemple PROFIL_G_R_O_U_P_E = new Fwexemple(67);
    	public static final Fwexemple GESTIONNAIRE_T_H_E_M_6 = new Fwexemple(128);
    	public static final Fwexemple DIMITRI = new Fwexemple(950);
    	public static final Fwexemple USER_INTRANET = new Fwexemple(400);
    	public static final Fwexemple PROFIL_P_R_O_F_I_L = new Fwexemple(79);
    	public static final Fwexemple ANGLAIS = new Fwexemple(21);
    	public static final Fwexemple GUILLAUME = new Fwexemple(90);
    	public static final Fwexemple CYRIL = new Fwexemple(34);
    	public static final Fwexemple VEGA_MESSAGERIE_GROUPE = new Fwexemple(102);
    	public static final Fwexemple ALINE = new Fwexemple(103);
    	public static final Fwexemple UTILISATEUR_P_D_A = new Fwexemple(652);
    	public static final Fwexemple AKIM = new Fwexemple(109);
    	public static final Fwexemple ROBOT = new Fwexemple(106);
    	public static final Fwexemple SERVICE_DÉVELOPPEMENT = new Fwexemple(47);
    	public static final Fwexemple FZEFZ = new Fwexemple(50);
    	public static final Fwexemple CHRISTOPHE = new Fwexemple(909);
    	public static final Fwexemple ADMINISTRATEUR_SYSTEME = new Fwexemple(49);
    	public static final Fwexemple DANIEL = new Fwexemple(908);
    	public static final Fwexemple MAINTENANCE_ATELIER = new Fwexemple(48);
    	public static final Fwexemple RENAUD = new Fwexemple(907);
    	public static final Fwexemple SÉBASTIEN = new Fwexemple(906);
    	public static final Fwexemple OLIVIER = new Fwexemple(904);
    	public static final Fwexemple SERVICE_COMMERCIAL = new Fwexemple(126);
    	public static final Fwexemple JEAN_PIERRE = new Fwexemple(902);
    	public static final Fwexemple BERNARD = new Fwexemple(901);
     
    	private final int code;
     
    	protected Fwexemple(int code) {
    		this.code = code;
    	}
     
    	public int toInt() { return code; }
     
    	public static Fwexemple fromInt(int code) {
    		switch (code) {
    			case 69: return WEB_USER;
    			case 64: return PROFIL_C_O_M;
    			case 65: return EQUIPE_DÉVELOPPEMENT;
    			case 200: return DEMO_USER;
    			case 66: return PROFIL_D_E_V1;
    			case 67: return PROFIL_G_R_O_U_P_E;
    			case 128: return GESTIONNAIRE_T_H_E_M_6;
    			case 950: return DIMITRI;
    			case 400: return USER_INTRANET;
    			case 79: return PROFIL_P_R_O_F_I_L;
    			case 21: return ANGLAIS;
    			case 90: return GUILLAUME;
    			case 34: return CYRIL;
    			case 102: return MESSAGERIE_GROUPE;
    			case 103: return ALINE;
    			case 652: return UTILISATEUR_P_D_A;
    			case 109: return AKIM;
    			case 106: return ROBOT;
    			case 47: return SERVICE_DÉVELOPPEMENT;
    			case 50: return FZEFZ;
    			case 909: return CHRISTOPHE;
    			case 49: return ADMINISTRATEUR_SYSTEME;
    			case 908: return DANIEL;
    			case 48: return MAINTENANCE_ATELIER;
    			case 907: return RENAUD;
    			case 906: return SÉBASTIEN;
    			case 904: return OLIVIER;
    			case 126: return SERVICE_COMMERCIAL;
    			case 902: return JEAN_PIERRE;
    			case 901: return BERNARD;
    			default: throw new RuntimeException("Unknown value: " + code);
    		}
    	}
     
    	public String toString () {
    		switch (code) {
    			case 69: return "Web User";
    			case 64: return "Profil : COM";
    			case 65: return "Equipe développement";
    			case 200: return "DEMO USER";
    			case 66: return "Profil : DEV1";
    			case 67: return "Profil : GROUPE";
    			case 128: return "Gestionnaire THEM 6";
    			case 950: return "Dimitri";
    			case 400: return "User intranet";
    			case 79: return "Profil : PROFIL";
    			case 21: return "ANGLAIS";
    			case 90: return "Guillaume";
    			case 34: return "Cyril";
    			case 102: return "MESSAGERIE GROUPE";
    			case 103: return "Aline";
    			case 652: return "Utilisateur PDA";
    			case 109: return "Akim";
    			case 106: return "Robot";
    			case 47: return "Service développement";
    			case 50: return "COMPTOIRfzefz";
    			case 909: return "Christophe";
    			case 49: return "Administrateur Systeme";
    			case 908: return "Daniel";
    			case 48: return "MAINTENANCE, ATELIER";
    			case 907: return "Renaud";
    			case 906: return "Sébastien";
    			case 904: return "Olivier";
    			case 126: return "Service commercial";
    			case 902: return "Jean-Pierre";
    			case 901: return "Bernard";
    			default: return "Unknown value";
    		}
    	}
    }
    et mon erreur généré est 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
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
     
    30 sept. 2010 09:56:34 net.sf.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 2.1.6
    30 sept. 2010 09:56:34 net.sf.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    30 sept. 2010 09:56:34 net.sf.hibernate.cfg.Environment <clinit>
    INFO: using CGLIB reflection optimizer
    30 sept. 2010 09:56:34 net.sf.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    30 sept. 2010 09:56:34 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.Configuration doConfigure
    INFO: Configured SessionFactory: null
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.Configuration secondPassCompile
    INFO: processing one-to-many association mappings
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.Configuration secondPassCompile
    INFO: processing one-to-one association property references
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.Configuration secondPassCompile
    INFO: processing foreign key constraints
    30 sept. 2010 09:56:36 net.sf.hibernate.dialect.Dialect <init>
    INFO: Using dialect: net.sf.hibernate.dialect.SQLServerDialect
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Use outer join fetching: true
    30 sept. 2010 09:56:36 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Using Hibernate built-in connection pool (not for production use!)
    30 sept. 2010 09:56:36 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Hibernate connection pool size: 20
    30 sept. 2010 09:56:36 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://localhost:1433;DatabaseName=Alocpro;
    30 sept. 2010 09:56:36 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: connection properties: {user=sa, password=gcsi}
    30 sept. 2010 09:56:36 net.sf.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
    INFO: Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
    30 sept. 2010 09:56:36 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
    INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Use scrollable result sets: true
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Use JDBC3 getGeneratedKeys(): true
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Optimize cache for minimal puts: false
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query language substitutions: {}
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
    30 sept. 2010 09:56:36 net.sf.hibernate.cfg.Configuration configureCaches
    INFO: instantiating and configuring caches
    30 sept. 2010 09:56:36 net.sf.hibernate.impl.SessionFactoryImpl <init>
    INFO: building session factory
    30 sept. 2010 09:56:36 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
    INFO: Not binding factory to JNDI, no JNDI name configured
    Exception in thread "main" net.sf.hibernate.MappingException: No persister for: com.hibernate.Fwexemple
    	at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)
    	at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2690)
    	at net.sf.hibernate.impl.SessionImpl.getSQLLoadable(SessionImpl.java:3817)
    	at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3796)
    	at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
    	at Test.main(Test.java:12)

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

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

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    tu n'a pas mappé la classe FWExemple, que tu utilise dans ta query, dans ton fichier de mapping hibernate.

  3. #3
    Membre averti
    Inscrit en
    Juin 2009
    Messages
    51
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 51
    Par défaut
    Merci pour la rapidité de votre réponse...Vu que je ne maîtrise pas trop, j'ai essayé de comprendre..et j'ai donc renommer mon fichier Fwexemple.java en F000usr.java...et mon fichier de mapping est le suivant :

    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
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
     
     
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    	"-//Hibernate/Hibernate Mapping DTD//EN"
    	"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
     
    <hibernate-mapping package="com.hibernate">
    	<class name="F000usr" table="F000USR">
    		<id
    			column="F000KY"
    			name="F000ky"
    			type="integer"
    		>
    			<generator class="vm" />
    		</id>
    		<property
    			column="F000SRVSMTP"
    			length="250"
    			name="F000srvsmtp"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000LIB"
    			length="60"
    			name="F000lib"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000EMAILPWD"
    			length="250"
    			name="F000emailpwd"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000MULTIAFF"
    			length="1"
    			name="F000multiaff"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000INTRANET"
    			length="1"
    			name="F000intranet"
    			not-null="true"
    			type="string"
    		 />
    		<property
    			column="T000LANGUE"
    			length="20"
    			name="T000langue"
    			not-null="true"
    			type="string"
    		 />
    		<property
    			column="F000DIVERS"
    			length="255"
    			name="F000divers"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000EMAIL"
    			length="250"
    			name="F000email"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000GRP"
    			length="1"
    			name="F000grp"
    			not-null="true"
    			type="string"
    		 />
    		<property
    			column="F000SRVPOP3"
    			length="250"
    			name="F000srvpop3"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000MOTPAS"
    			length="100"
    			name="F000motpas"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000NOMUSR"
    			length="20"
    			name="F000nomusr"
    			not-null="true"
    			type="string"
    		 />
    		<property
    			column="F000MAILLOG"
    			length="250"
    			name="F000maillog"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000NIV"
    			length="1"
    			name="F000niv"
    			not-null="true"
    			type="string"
    		 />
    		<property
    			column="F000USRACT"
    			length="40"
    			name="F000usract"
    			not-null="false"
    			type="string"
    		 />
    		<property
    			column="F000TYPEP"
    			length="20"
    			name="F000typep"
    			not-null="true"
    			type="string"
    		 />
    		<property
    			column="F000ACTIF"
    			length="1"
    			name="F000actif"
    			not-null="false"
    			type="string"
    		 />
     
    		<many-to-one
    			class="F050tiers"
    			name="K000050tie"
    			not-null="true"
    		>
    			<column name="K000050TIE" />
    		</many-to-one>
    		<many-to-one
    			class="F004menu"
    			name="K000004menu"
    			not-null="true"
    		>
    			<column name="K000004MENU" />
    		</many-to-one>
    		<many-to-one
    			class="Ftd5prof"
    			name="K000td5prof"
    			not-null="true"
    		>
    			<column name="K000TD5PROF" />
    		</many-to-one>
    		<many-to-one
    			class="F903conn"
    			name="L000903con"
    			not-null="true"
    		>
    			<column name="L000903CON" />
    		</many-to-one>
    		<many-to-one
    			class="Ftc1groupe"
    			name="K000tc1nat"
    			not-null="true"
    		>
    			<column name="K000TC1NAT" />
    		</many-to-one>
    		<many-to-one
    			class="F030age"
    			name="K000030age"
    			not-null="true"
    		>
    			<column name="K000030AGE" />
    		</many-to-one>
    		<many-to-one
    			class="F033sect"
    			name="K000033sect"
    			not-null="true"
    		>
    			<column name="K000033SECT" />
    		</many-to-one>
    		<many-to-one
    			class="F004menu"
    			name="K000004web"
    			not-null="true"
    		>
    			<column name="K000004WEB" />
    		</many-to-one>
    		<set inverse="true" name="F91ZMEMOSetByK91z000usr2">
    			<key column="K91Z000USR2" />
    			<one-to-many class="F91zmemo" />
    		</set>
    		<set inverse="true" name="F00ZGROUPESetByK00z000grp">
    			<key column="K00Z000GRP" />
    			<one-to-many class="F00zgroupe" />
    		</set>
    		<set inverse="true" name="F06TINFFRSSet">
    			<key column="K06T000USR" />
    			<one-to-many class="F06tinffrs" />
    		</set>
    		<set inverse="true" name="F575ETATSet">
    			<key column="K575000USR2" />
    			<one-to-many class="F575etat" />
    		</set>
    		<set inverse="true" name="F570MVTSet">
    			<key column="K570000USR" />
    			<one-to-many class="F570MVT" />
    		</set>
    		<set inverse="true" name="F91ZMEMOSetByK91z000usr">
    			<key column="K91Z000USR" />
    			<one-to-many class="F91zmemo" />
    		</set>
    		<set inverse="true" name="F410LIGSetByK410000equ">
    			<key column="K410000EQU" />
    			<one-to-many class="F410lig" />
    		</set>
    		<set inverse="true" name="F940ACTISetByK940000dest">
    			<key column="K940000DEST" />
    			<one-to-many class="F940acti" />
    		</set>
    		<set inverse="true" name="F990ARCHIVESet">
    			<key column="K990000USR" />
    			<one-to-many class="F990archive" />
    		</set>
    		<set inverse="true" name="F11VTARIFSet">
    			<key column="K11V000USR" />
    			<one-to-many class="F11vtarif" />
    		</set>
    		<set inverse="true" name="F410LIGSetByK410000usr2">
    			<key column="K410000USR2" />
    			<one-to-many class="F410lig" />
    		</set>
    		<set inverse="true" name="F00ZGROUPESetByK00z000usr">
    			<key column="K00Z000USR" />
    			<one-to-many class="F00zgroupe" />
    		</set>
    		<set inverse="true" name="F940ACTISetByK940000emet">
    			<key column="K940000EMET" />
    			<one-to-many class="F940acti" />
    		</set>
    	</class>
    </hibernate-mapping>
    Et maintenant j'obtiens le même message sauf qu'il s'agit de "com.hibernate.F000usr"

    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
     
     
    30 sept. 2010 11:10:19 net.sf.hibernate.cfg.Environment <clinit>
    INFO: Hibernate 2.1.6
    30 sept. 2010 11:10:19 net.sf.hibernate.cfg.Environment <clinit>
    INFO: hibernate.properties not found
    30 sept. 2010 11:10:19 net.sf.hibernate.cfg.Environment <clinit>
    INFO: using CGLIB reflection optimizer
    30 sept. 2010 11:10:19 net.sf.hibernate.cfg.Configuration configure
    INFO: configuring from resource: /hibernate.cfg.xml
    30 sept. 2010 11:10:19 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
    INFO: Configuration resource: /hibernate.cfg.xml
    30 sept. 2010 11:10:20 net.sf.hibernate.cfg.Configuration doConfigure
    INFO: Configured SessionFactory: null
    30 sept. 2010 11:10:20 net.sf.hibernate.cfg.Configuration secondPassCompile
    INFO: processing one-to-many association mappings
    30 sept. 2010 11:10:20 net.sf.hibernate.cfg.Configuration secondPassCompile
    INFO: processing one-to-one association property references
    30 sept. 2010 11:10:20 net.sf.hibernate.cfg.Configuration secondPassCompile
    INFO: processing foreign key constraints
    30 sept. 2010 11:10:20 net.sf.hibernate.dialect.Dialect <init>
    INFO: Using dialect: net.sf.hibernate.dialect.SQLServerDialect
    30 sept. 2010 11:10:20 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Use outer join fetching: true
    30 sept. 2010 11:10:20 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Using Hibernate built-in connection pool (not for production use!)
    30 sept. 2010 11:10:20 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: Hibernate connection pool size: 20
    30 sept. 2010 11:10:21 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: using driver: net.sourceforge.jtds.jdbc.Driver at URL: jdbc:jtds:sqlserver://localhost:1433;DatabaseName=Alocpro;
    30 sept. 2010 11:10:21 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
    INFO: connection properties: {user=sa, password=gcsi}
    30 sept. 2010 11:10:21 net.sf.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
    INFO: Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
    30 sept. 2010 11:10:21 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
    INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
    30 sept. 2010 11:10:21 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Use scrollable result sets: true
    30 sept. 2010 11:10:21 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Use JDBC3 getGeneratedKeys(): true
    30 sept. 2010 11:10:21 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Optimize cache for minimal puts: false
    30 sept. 2010 11:10:21 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: Query language substitutions: {}
    30 sept. 2010 11:10:21 net.sf.hibernate.cfg.SettingsFactory buildSettings
    INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
    30 sept. 2010 11:10:21 net.sf.hibernate.cfg.Configuration configureCaches
    INFO: instantiating and configuring caches
    30 sept. 2010 11:10:21 net.sf.hibernate.impl.SessionFactoryImpl <init>
    INFO: building session factory
    30 sept. 2010 11:10:21 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
    INFO: Not binding factory to JNDI, no JNDI name configured
    Exception in thread "main" net.sf.hibernate.MappingException: No persister for: com.hibernate.F000usr
    	at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:347)
    	at net.sf.hibernate.impl.SessionImpl.getClassPersister(SessionImpl.java:2690)
    	at net.sf.hibernate.impl.SessionImpl.getSQLLoadable(SessionImpl.java:3817)
    	at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3796)
    	at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
    	at Test.main(Test.java:13)
    A priori ca m'a l'air correct...mais ca me retourne rien...

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

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

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    tu inclue bien ton mapping dans ton hibernate.cfg.xml?

  5. #5
    Membre averti
    Inscrit en
    Juin 2009
    Messages
    51
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 51
    Par défaut
    En fait , je viens de m'apercevoir en fouillant sur les forums que je n'avais pas intégrer la ligne :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    <!-- <mapping resource="src/F000usr.hbm.xml"/>-->
    <mapping resource="src/F000usr.hbm.xml"/>
    Mais à priori il ne trouve pas mon fichier qui se trouve dans :

    Projet Hibernate / Rep src / F000usr.hbm

    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
     
     
    Exception in thread "main" java.lang.ExceptionInInitializerError
    	at Test.main(Test.java:9)
    Caused by: java.lang.RuntimeException: Problème de configuration : Resource: src/F000usr.hbm.xml not found
    	at com.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:16)
    	... 1 more
    Caused by: net.sf.hibernate.MappingException: Resource: src/F000usr.hbm.xml not found
    	at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:334)
    	at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)
    	at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)
    	at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
    	at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)
    	at com.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:14)
    	... 1 more
    Dois-je ajouter l'extension .xml sur mon fichier hbm ?
    Sinon, je crois avoir mis le bon chemin...

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

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

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    retire ce src, il n'apparait pas dans le classpath, il ne sert qu'à la compilation.

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

Discussions similaires

  1. [SQL-Server] Syntaxe sur une requete
    Par Cobax dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 04/05/2009, 18h16
  2. erreur de syntaxe sur la requete iif sous sql access
    Par nadia123456 dans le forum Requêtes et SQL.
    Réponses: 6
    Dernier message: 29/08/2008, 15h32
  3. Erreur de syntaxe sur une Requete Update
    Par samtheh dans le forum Requêtes et SQL.
    Réponses: 1
    Dernier message: 01/06/2007, 13h07
  4. Sechage sur syntaxe de requete
    Par wonderyan dans le forum PostgreSQL
    Réponses: 8
    Dernier message: 27/03/2007, 12h18
  5. [SQL] Erreur de syntaxe sur requete complexe
    Par tiger33 dans le forum PHP & Base de données
    Réponses: 3
    Dernier message: 07/11/2006, 09h54

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