Hello everybody!
I'm a french student using RCP and Hibernate for developing my end studies project :
Focus.
I'd like to integrate Hibernate in my RCP application but my problem is curious. Thanks to google, I found this article :
Hibernate and RCP integration but that doesn't work in my case (maybe because I'm not really sure where insert the Class.forName line). I tried to find help on eclipse RCP forum but for the moment they have no idea... So!
In the RCP menu, I have this run() method :
Code:
@Override
public void run()
{
System.out.println("->> Run testHibernateAction");
testHibernate testHib = new testHibernate();
testHib.connexion();
System.out.println("<<- Fin de test");
return;
}
And here is the testHibernate class :
Code:
public class testHibernate
{
public testHibernate()
{
System.out.println(" => Constructor ");
String path = "src/hibernate.cfg.xml";
File file = new File(path);
System.out.println(file.exists());
if (HibernateHelper.changeConnexion(path) == -1)
{
System.out.println("Couldn't change configuration file.");
System.out.println("Exiting...");
return;
}
else
System.out.println("HibernateHelper.changeConnexion != -1")
}
public void connexion()
{
System.out.println(" -> Methode connexion");
System.out.println(" try getSession");
Session s = HibernateHelper.getSession();
s.getTransaction().begin();
s.getTransaction().commit();
System.out.println(" transaction finished");
System.out.println(" <- Methode connexion");
}
When I launch my RCP application with this code, I just have :
Code:
->> Run testHibernateAction
Why I haven't the printl output of testHibernate.connexion????
If I comment all the connexion methode, I have :
Code:
->> Run testHibernateAction
=> Constructor
false
Why, the hibernate configuration file is not found???? It is in the src directory... And I tried to put this file everywhere... Always false!
And, over all, why I have never the println output of the connexion method? It's crazy!
Any idea? Please, please, help me! =(
(Sorry if I made english mistakes!)
Thomas