-->
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.  [ 10 posts ] 
Author Message
 Post subject: 2.1 beta 3b
PostPosted: Mon Sep 08, 2003 7:41 am 
Newbie

Joined: Mon Sep 08, 2003 7:30 am
Posts: 17
Hi Gavin,

is there something wrong with JTA transactions?

I used to call sessionFactory.openSession(), use the session and then close it.

Now you have to call session.beginTransaction() and later to commit or rollback the transaction explicitely, otherways you get a NPE at the following line in SessionImpl.java line 3171:

tm.getTransaction().registerSynchronization( new CacheSynchronization(this) );

Sounds like a transaction has to be active upon connect() beeing called ...

Thanx
Markus


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 7:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
This stuff certainly changed in beta 3 (quite intentionally).

I think you might get an NPE here if you have a TransactionManagerLookup configured in your properties, but there is no JTA transaction active when you connect().

Perhaps I need to do a little check to see that there is a JTA transaction.

Are you running inside an appserver or not?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 8:07 am 
Newbie

Joined: Mon Sep 08, 2003 7:30 am
Posts: 17
Yeah, I'm running inside JBoss 3.2.

Only to mention it: I didn't connect() explicitly, I suppose this is done implicitly after opening a session and then doing session.load() or similar things.

For now, I added trans.begin() and tans.commit()/rollback() everywhere and it rocks ...

Thanx


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 8:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
And is there a JTA transaction?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 8:35 am 
Newbie

Joined: Mon Sep 08, 2003 7:30 am
Posts: 17
Now or before?

Before I had:

session = sessionFactory.openSession();
session.load(...);
session.close();

Now:

session = sessionFactory.openSession();
trans = session.beginTransaction(); /* this ensures a running transaction */
session.load(...);
trans.commit();
session.close();


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 10:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
NO, I mean a JBoss JTA transaction - not a Hibernate transaction!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 10:05 am 
Newbie

Joined: Mon Sep 08, 2003 7:30 am
Posts: 17
No, there is no JTA transaction active around my stuff ...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 11:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Yeah, so i think that explains it.

If you unset the net.sf.hibernate.transactionmanager_lookup_class property, the NPE will disappear.

Still, I will make it behave a bit more gracefully.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 08, 2003 1:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
OK, I had a quick chat with Bill Burke, and we now have no more NPEs in JBoss, I hope. In CVS.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 09, 2003 1:34 am 
Newbie

Joined: Mon Sep 08, 2003 7:30 am
Posts: 17
Thanks guys, I'll try it.


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