Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Application Service, Session Facade and transaction

 
Ashish Sarin
author
Ranch Hand
Posts: 444
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a few questions around Application Services, Session Facade:
1. What are the advantages of modelling application service as POJO vs Stateless Session bean ?
2. What is the granularity of methods defined in application service ? If client invokes method x1() on the Session Facade then the corresponding application service will be invoked just once to do the business complete processing ? or the method x1() will invoke couple of methods on application service to complete the business logic ?
3. If application service is modelled as POJO then the transaction (in case of CMT) is applied on the corresponding method in Session Facade ?

thanks
Ashish
 
J Gupta
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Using POJOs you decouple your application logic from framework such as EJB, Spring or anything else. You can later expose your POJO as anyone of these. There are lots of adavantages such as making your testing easier, your business logic is free from infrastructure code (Espesially for example for EJB you don't need lookup code), POJOs are lightweight

2. I think this a design question, depending upon your requirements. You want to keep loose coupling between your client and application component. I prefer a single call between client and application component. This will make life easier as well if you want to expose your POJOs as EJB or Webservice or any other framework

3. There are two main ways to implement declarative transaction management for POJO You can use Spring framework or EJB 3.0 annotation



I have a few questions around Application Services, Session Facade:
1. What are the advantages of modelling application service as POJO vs Stateless Session bean ?
2. What is the granularity of methods defined in application service ? If client invokes method x1() on the Session Facade then the corresponding application service will be invoked just once to do the business complete processing ? or the method x1() will invoke couple of methods on application service to complete the business logic ?
3. If application service is modelled as POJO then the transaction (in case of CMT) is applied on the corresponding method in Session Facade ?

thanks
Ashish
 
aditee sharma
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, to chip in late, I just chanced upon this article while looking for something else.
I think the most striking difference between a pojo and EJB session facade is that the latter can handle distibued transactions.However, EJBs also come with a lot of baaggage, and testing is difficult.
 
Ashish Sarin
author
Ranch Hand
Posts: 444
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats true aditee. I used stateless session beans based Application Service because I can use container-managed transactions, and also the enterprise bean pooling feature supported by application servers. I didn't bother much about the testability of the application as these application services were anyways behind the stateless session facades that I used in my design.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic