slt


je suis débutant en j2EE et je suis en train de faire une application jsf2 , spring , hibernate pour cela j'ai utilisé hibernate tools et pour tester ca j'ai mis la classe 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
package com.restaurants.test;
 
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
 
import com.restaurants.model.Ville;
 
 
 
 
public class Main {
 
 
	public static void main(String[] args) {
		Session session = null;
 
 
		try{
// This step will read hibernate.cfg.xml and prepare hibernate for use
			  SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
			 session =sessionFactory.openSession();
 //Create new instance of Contact and set values in it by reading them from form object
				 System.out.println("Inserting Record");
				 Ville q = new Ville();
				 q.setIdVille(123);
				 q.setNomVille("test");
 
				  session.save(q);
				  System.out.println("Done");
				  }catch(Exception e){
				  System.out.println(e.getMessage());
				  }finally{
				  // Actual contact insertion will happen at this step
				  session.flush();
				  session.close();
 
			  }
 
			  }
			}
mais l'erreur :
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
package com.restaurants.test;
 
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
 
import com.restaurants.model.Ville;
 
 
 
 
public class Main {
 
 
	public static void main(String[] args) {
		Session session = null;
 
 
		try{
// This step will read hibernate.cfg.xml and prepare hibernate for use
			  SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
			 session =sessionFactory.openSession();
 //Create new instance of Contact and set values in it by reading them from form object
				 System.out.println("Inserting Record");
				 Ville q = new Ville();
				 q.setIdVille(123);
				 q.setNomVille("test");
 
				  session.save(q);
				  System.out.println("Done");
				  }catch(Exception e){
				  System.out.println(e.getMessage());
				  }finally{
				  // Actual contact insertion will happen at this step
				  session.flush();
				  session.close();
 
			  }
 
			  }
			}
les jars sont :
Nom : Untitled.png
Affichages : 143
Taille : 10,6 Ko
je sais pas ce que je doit modifier !!!!!!!