Salut,

J'ai commencé à utiliser Hibernate. J'ai commencé par essayer de faire marcher les exemples que j'ai trouvé sur le tutoriel du site ( http://defaut.developpez.com/tutorie...pse/hibernate/ ), adapté à ma base de donnée MySQL mais de nombreuses erreures apparraissent au lancement du main :


-----------------------------

Finalement, j'ai tout bien refait (surtout concernant l'ajout des jar) et ca a marche (les données ont été entrées dans la base de donnée).


Le fichier hibernate.cfg.xml 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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
 
<hibernate-configuration>
    <session-factory >
 
		<!-- local connection properties -->
		<property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>
		<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
		<property name="hibernate.connection.username">root</property>
		<property name="hibernate.connection.password"></property>
		<!-- property name="hibernate.connection.pool_size"></property -->
 
		<!-- dialect for MySQL -->
        <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
 
        <property name="hibernate.show_sql">false</property>
        <property name="hibernate.use_outer_join">true</property>
        <!-- <property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
        <property name="jta.UserTransaction">java:comp/UserTransaction</property> -->
 
<property name="hibernate.transaction.factory_class">
   net.sf.hibernate.transaction.JDBCTransactionFactory
</property>
    </session-factory>
</hibernate-configuration>

Mais il me met toujours des messages en rouge. Est-ce normal?

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
6 avr. 2005 10:25:27 net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.6
6 avr. 2005 10:25:27 net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
6 avr. 2005 10:25:27 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
6 avr. 2005 10:25:27 net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
6 avr. 2005 10:25:27 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
6 avr. 2005 10:25:27 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: TContact.hbm
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: com.minosis.hibernate.TContact -> t_contact
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
6 avr. 2005 10:25:28 net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.MySQLDialect
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximim outer join fetch depth: 2
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: true
 
6 avr. 2005 10:25:28 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
6 avr. 2005 10:25:28 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
6 avr. 2005 10:25:28 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/test
6 avr. 2005 10:25:28 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root, password=}
6 avr. 2005 10:25:28 net.sf.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: net.sf.hibernate.transaction.JDBCTransactionFactory
6 avr. 2005 10:25:28 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): true
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
6 avr. 2005 10:25:28 net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
6 avr. 2005 10:25:28 net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
6 avr. 2005 10:25:29 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured