-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Integration of Hibernate in RCP application
PostPosted: Tue May 22, 2007 2:35 pm 
Newbie

Joined: Tue May 22, 2007 2:15 pm
Posts: 2
Location: France
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

_________________
French student in computer science
http://pfe.epitech.net/focus/


Last edited by Echo_94 on Wed May 23, 2007 10:15 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Tue May 22, 2007 9:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Your using a relative file path. Check your PATH variable. Your base is likely to be the bin directory. The File object should be able to tell you to full path as it sees it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 23, 2007 10:11 am 
Newbie

Joined: Tue May 22, 2007 2:15 pm
Posts: 2
Location: France
david wrote:
Your using a relative file path. Check your PATH variable. Your base is likely to be the bin directory. The File object should be able to tell you to full path as it sees it.

Thank you, I'll try tonight...

And no idea about the integration of Hibernate in RCP?

_________________
French student in computer science
http://pfe.epitech.net/focus/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.