-->
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.  [ 1 post ] 
Author Message
 Post subject: Can't figure out how to use StatelessSession correctly
PostPosted: Thu Aug 17, 2006 3:26 pm 
Newbie

Joined: Wed Aug 31, 2005 8:59 pm
Posts: 1
I've been trying to figure out how to use stateless sessions correctly, but I'm pretty new to Hibernate (3.1.3), MDB's, and JTA. The code below is inside of an MDB which normally has its transactions handled by JTATransactionFactory and JBossTransactionManagerLookup:

Code:
StatelessSession session = sessionFactory.openStatelessSession();

int i = 0;
for (RevenueData data : dataMap.values()) {
    session.insert(data);
}


Outside of these few lines, I don't touch transactions or hibernate anywhere else in my code. If I leave the code like this, the data gets inserted but JBoss complains that I didn't close the connection.

If I close the connection myself using session.close(), the data isn't inserted. I don't know why other than I get a message in my log about the XA transaction being rolled back without a reason being quoted. I know this isn't very specific.

I'm assuming that the the reason why everything gets inserted in the first case is because the XA transaction is getting committed. What's the right way to do this? I'd like my connection to be properly closed so my log doesn't get littered with JBoss's complaints, but I can't seem to figure out how to make it happen.

Thanks,
Matt


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

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.