Bonjour tout le monde,
J'apprend à partir d'un tutoriel hibernate créé par julien DEFAUT.

Je suis à la dernière parti du tutoriel mais lorsque je compile, il me génére des erreurs les voici:
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
INFO: Hibernate 2.1.6
3 avr. 2007 15:02:10 net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
3 avr. 2007 15:02:10 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
3 avr. 2007 15:02:10 net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
3 avr. 2007 15:02:10 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
3 avr. 2007 15:02:10 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: TContact.hbm.xml
3 avr. 2007 15:02:13 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: com.minosis.hibernate.TContact -> t_contact
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
ATTENTION: No dialect set - using GenericDialect: Dialect class not found: org.hibernate.dialect.MySQLDialect
3 avr. 2007 15:02:14 net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.GenericDialect
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: true
3 avr. 2007 15:02:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
3 avr. 2007 15:02:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
3 avr. 2007 15:02:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://localhost/base1
3 avr. 2007 15:02:14 net.sf.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=root}
3 avr. 2007 15:02:14 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 15:02:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): true
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
3 avr. 2007 15:02:14 net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
3 avr. 2007 15:02:14 net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
3 avr. 2007 15:02:15 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Exception in thread "main" net.sf.hibernate.QueryException: * only allowed inside aggregate function in SELECT [SELECT * FROM t_contact WHERE nom='Dupont']
	at net.sf.hibernate.hql.SelectParser.token(SelectParser.java:114)
	at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
	at net.sf.hibernate.hql.ClauseParser.end(ClauseParser.java:114)
	at net.sf.hibernate.hql.PreprocessingParser.end(PreprocessingParser.java:143)
	at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:30)
	at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
	at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
	at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:294)
	at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1562)
	at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1533)
	at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1521)
	at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1513)
	at Test.main(Test.java:20)
.


Je vous donne le code que je génére le voici:
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
 
 
 
 
 
import java.util.Iterator;
import java.util.Vector;
 
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=(Session)HibernateUtil.currentSession();
	Iterator list=(Iterator)session.find("SELECT * FROM t_contact WHERE nom like '%t'");
	while(list.hasNext())
	{
		TContact contact=(TContact) list.next();
		System.out.println(contact.getNom());
	}
	HibernateUtil.closeSession();
 
 
}
}
Les informations qui sont rentrées dans la base de données correspondant à la requete de sélection n'apparait pas.
Je vous remercie de votre aide