Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Application Service, Session Facade and transaction

 
author
Posts: 469
20
  • 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
 
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
 
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
Posts: 469
20
  • 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.
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic