Bonjour tout le monde,
Je travaille à partir d'un tutoriel pour apprendre hibernate, c'est le tutoriel de julien DEFAUT.
J'ai suivi methodiquement, j'ai configuré correctement hibernate.
Mais lors de la compilation de cette page j'ai cette erreur qui est générée:
Le code que je compile est celui ci:
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 3 avr. 2007 11:33:50 net.sf.hibernate.cfg.Environment <clinit> INFO: Hibernate 2.1.6 3 avr. 2007 11:33:50 net.sf.hibernate.cfg.Environment <clinit> INFO: hibernate.properties not found 3 avr. 2007 11:33:50 net.sf.hibernate.cfg.Environment <clinit> INFO: using CGLIB reflection optimizer 3 avr. 2007 11:33:50 net.sf.hibernate.cfg.Configuration configure INFO: configuring from resource: /hibernate.cfg.xml 3 avr. 2007 11:33:50 net.sf.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-many association mappings 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-one association property references 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing foreign key constraints 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.SettingsFactory buildSettings ATTENTION: No dialect set - using GenericDialect: Dialect class not found: org.hibernate.dialect.MySQLDialect 3 avr. 2007 11:33:52 net.sf.hibernate.dialect.Dialect <init> INFO: Using dialect: net.sf.hibernate.dialect.GenericDialect 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use outer join fetching: true 3 avr. 2007 11:33:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Using Hibernate built-in connection pool (not for production use!) 3 avr. 2007 11:33:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Hibernate connection pool size: 20 3 avr. 2007 11:33:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://localhost/Base1 3 avr. 2007 11:33:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: connection properties: {user=root} 3 avr. 2007 11:33:52 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use scrollable result sets: true 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use JDBC3 getGeneratedKeys(): true 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Optimize cache for minimal puts: false 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Query language substitutions: {} 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider 3 avr. 2007 11:33:52 net.sf.hibernate.cfg.Configuration configureCaches INFO: instantiating and configuring caches 3 avr. 2007 11:33:53 net.sf.hibernate.impl.SessionFactoryImpl <init> INFO: building session factory 3 avr. 2007 11:33:56 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.minosis.hibernate.TContact 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.getPersister(SessionImpl.java:2697) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:763) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at Test.main(Test.java:16)
Je vous remercie de 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 import net.sf.hibernate.*; import com.minosis.hibernate.*; import com.minosis.bdd.*; public class Test { public static void main(String[] args) throws HibernateException { Session session=HibernateUtil.currentSession(); Transaction tx=session.beginTransaction(); TContact contact=new TContact(); contact.setNom("Dupont"); contact.setPrenom("Jean"); contact.setAge(new Integer(33)); session.save(contact); /* contact=new TContact(); contact.setNom("Lambert"); contact.setPrenom("Julie"); contact.setAge(new Integer(27)); session.save(contact); */ tx.commit(); HibernateUtil.closeSession(); } }
Partager