Boujour,
Je suis nouvelle dans le monde de hibernate, j'essaye de réaliser une petite application d'authentification dans laquelle on saisie son login et mot de passe, on vérifie les données dans une base mysql, on récupère le profil de l'utilisateur, et selon ce profil on le dirige vers une page spécifique.
Pour ceci j'utilise jsf avec hibernate et un serveur apache tomcat6 dans eclipse ganymede.
le problème qui se pose est tel que :
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 ..... 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.Configuration configure INFO: configuring from resource: /hibernate.cfg.xml 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.Configuration getConfigurationInputStream INFO: Configuration resource: /hibernate.cfg.xml 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.Configuration addResource INFO: Mapping resource: Compte.hbm 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.Binder bindRootClass INFO: Mapping class: test.hibernate.Compte -> compte 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.Configuration doConfigure INFO: Configured SessionFactory: null 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-many association mappings 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing one-to-one association property references 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.Configuration secondPassCompile INFO: processing foreign key constraints 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.SettingsFactory buildSettings ATTENTION: No dialect set - using GenericDialect: Dialect class not found: rg.hibernate.dialect.MySQL5InnoDBDialect 22 févr. 2010 10:26:41 net.sf.hibernate.dialect.Dialect <init> INFO: Using dialect: net.sf.hibernate.dialect.GenericDialect 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use outer join fetching: true 22 févr. 2010 10:26:41 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Using Hibernate built-in connection pool (not for production use!) 22 févr. 2010 10:26:41 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: Hibernate connection pool size: 20 22 févr. 2010 10:26:41 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://localhost:3306/login 22 févr. 2010 10:26:41 net.sf.hibernate.connection.DriverManagerConnectionProvider configure INFO: connection properties: {user=root, password=} 22 févr. 2010 10:26:41 net.sf.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup INFO: No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended) 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use scrollable result sets: true 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Use JDBC3 getGeneratedKeys(): true 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Optimize cache for minimal puts: false 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: echoing all SQL to stdout 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: Query language substitutions: {} 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.SettingsFactory buildSettings INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider 22 févr. 2010 10:26:41 net.sf.hibernate.cfg.Configuration configureCaches INFO: instantiating and configuring caches 22 févr. 2010 10:26:42 net.sf.hibernate.impl.SessionFactoryImpl <init> INFO: building session factory 22 févr. 2010 10:26:42 net.sf.hibernate.impl.SessionFactoryObjectFactory addInstance INFO: Not binding factory to JNDI, no JNDI name configured
je n'arrive pas à fixer la JNDI !!!!
mon la fonction de vérification que j'utilise est :
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 public String Role() throws Exception { SessionFactory sf =new Configuration().configure().buildSessionFactory(); Session session =sf.openSession(); String role = null; try{ //tx = session.beginTransaction(); List list = session.find("select * from login.compte where login='"+getLogin()+"' and pwd='"+getPwd()+"'"); Iterator it = list.iterator(); while(it.hasNext()){ Compte compte = (Compte)it.next(); role=""+compte.getRole()+"";} }catch(Exception e) {} session.close(); if(role!= null) return role; else return "notfound"; }
ma base de données login contient une table Compte de 4 champ :
id
login
mdp
role
Je serais reconnaissante si j'obtiens une aide
Merci d'avance !!
Partager