-->
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.  [ 2 posts ] 
Author Message
 Post subject: Session and Transaction across multiple business Components
PostPosted: Tue Sep 20, 2005 10:39 pm 
Newbie

Joined: Tue Sep 20, 2005 10:22 pm
Posts: 6
I am looking for some advice on how to solve this issue. I currently have multiple business components (all in the same assembly) which do some business logic. So for instance, i have an Order Business Component and a Inventory Business Component. Both of these components are marked as internal. The inventory component has one function called ModifyInventoryCount and the Order Component has one function called TakeOrder.

I also have anohter layer on top of this called a service layer that is public and all external assemblies access.

The order component calls the inventory components ModifyInventoryCount in its TakeOrder function. The problem im having is how do i create a transaction around this? currently each function opens its own session and its own transaction and of course closes each one, but i wish to wrap them in one session and one transaction?


i thought of a coupe possible solutions

1.) use com+ transaction attributes on the web service since these will be used over a web service. Can this be done with Nhibernate in my scenario? I am not really wild about this since i know basically nothing about com+

2.) Pass an ISession object as a parameter into every method of a business component. This would work but doesnt seem very clean. Of course my service layer would then be responisble for the session and transaction management.

3.) duplicate the ModifiyInventoryCount code inside of the TakeOrder function so that it can all be wraped in on transaction. This is screaming maintenance nightmare.

What do you guys normally do in this situation? or am i going about this all wrong? :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 21, 2005 3:57 am 
Regular
Regular

Joined: Fri Jun 11, 2004 6:27 am
Posts: 81
Location: Yaroslavl, Russia
In similar setup we use COM+ transactions. You can find approximate code here.

Please note, that this code a bit outdated. For example, passing a ready and open connection to the Session.Open prevents from caching objects in second level cache.

_________________
Best,
Andrew Mayorov // BYTE-force


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