-->
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.  [ 5 posts ] 
Author Message
 Post subject: SessionFactory getCurrentSession
PostPosted: Fri Jun 17, 2005 10:13 am 
Newbie

Joined: Wed Jun 01, 2005 11:00 am
Posts: 17
Location: UK
Hi,

Apologies in advance what what may seem to be a silly question. I am working with Hibernate 3.0.5 and really appreciate the tool. However, I have been looking at the documentation regarding transactions. I want to call the method getCurrentTransaction on my SessionFactory. It does not seem to be there on the object code. Am I making a reallly obcious mistake.

thanks for any advice.

Ben

this is my import

import org.hibernate.SessionFactory;

yet I cannot getCurrent Session();


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 10:22 am 
Regular
Regular

Joined: Thu Apr 21, 2005 9:05 am
Posts: 50
Location: Boston, U.S
Ben,

There is no such method called getCurrentTransaction(),
Just for your information...

You use getCurrentSession only when you have intended
to use Container Managed Transaction. For CMT you are
not required to handle the transaction.

If you are not using CMT, then try getSession() method
and then from sesson you can make calls like beginTransaction()
and commit etc.....

Hope it helps.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 10:24 am 
Newbie

Joined: Wed Jun 01, 2005 11:00 am
Posts: 17
Location: UK
Sorry thats a typo on my side.
I am trying to use getCurrentSession() but the APi I have downloaded does not have it??? I am working in a CMT environment and have found hibernate to be really useful. Maybe I am losing the plot ???

Ben


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 10:27 am 
Regular
Regular

Joined: Thu Apr 21, 2005 9:05 am
Posts: 50
Location: Boston, U.S
Could you make sure

1. that Hibernater.jar is in the class path
2. You have downloaded the correct version

I have implemented CMT in my proejct but i downloaded sometime last week.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 17, 2005 10:34 am 
Newbie

Joined: Wed Jun 01, 2005 11:00 am
Posts: 17
Location: UK
Hi mahikty I double checked and found I had an old jar in my classpath
sorry for wasting your time. That will teach me for having a beer with my firday lunch :-) ...

Thanks for your help


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.