Win a copy of Spark in Action this week in the Open Source Projects 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Help me in designing an J2EE application

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have an application which used jsps ans servlets as web layer and POJO as business layer and DAO s as data base layer.

Now the question is, if I want to redesign this using EJBs how ll I do? I will retain the JSP pages as such and populate a DTO from the JSP inputs, call a session bean in the servlet for performing all business logics, and an entity bean will be used for doing the data base updates.

Is this design Ok?
I have a doubt whether I can use servlet to call a session bean. Any better design or suggestions?
 
Ranch Hand
Posts: 464
Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,

I prefer calling the session bean through a delegate. Better use a delegate between the servlet and the sessionbean. Rest is fine i guess.

Regards
Venkatesh S
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically, there is no problem in calling an EJB from a servlet (or JSP, Struts Action, Swing, etc). But you can certainly argue that the client should not know how the business logic is implemented. My preference is to use a business delegate between the servlet and EJB. The client invokes business methods on the BD and the BD invokes the required methods in the business logic layer. This layer might consist of just POJOs today, tomorrow it might consist of EJBs and POJOs.

I suggest you implement the BD first, then add EJBs.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use of Business Delegate is a j2ee design patterns that have a lot of advantages. Most important patterns to implement if you decide to use EJB : Service Locator (use to look up your ejb) and Proxy(use to make separation and abstraction between your presentation layer and the ressource one).

I recommend you to see the sun documentation about it :
http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html

Don't forget to think about packaging of your j2ee module then will contain at least 2 j2ee module now so that you can use the j2ee application classloading advantages.
 
saran sadaiyappan
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Thanks for all your valuable feedback. I came to know about what is a business delegate object and I will implpement the same.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use a vendor framework with proprietary a BD architecture. Inside it does its own marshalling and then uses strategies to make the service call via native Java methods, EJB, raw sockets, XML/HTTP, JMS, etc. So the BD methods are the business methods on the remote object and the strategy methods are about making remote calls to any service with any set of parameters. Cool stuff.
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I recommend you to see the sun documentation about it :
http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html



is there any framework available (open-source or vendor implementation) that implement Business Delegate pattern ?


Don't forget to think about packaging of your j2ee module then will contain at least 2 j2ee module now so that you can use the j2ee application classloading advantages.



don't quite understand. what is class loading? , 2 EAR files for load balancing?

thanks all
tony
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic