| Author |
Pattern for DOS/console + Entity(ejb3)
|
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
Help please? For jee, if front end is jsp/servlet, I would say, roughly: JSP -- (servlet controller) -- session bean (processor) -- entity beans How about for the one I mentioned in the title? [DOS/console + Entity(ejb3) ]
|
 |
Peer Reynders
Bartender
Joined: Aug 19, 2005
Posts: 2906
|
|
JSP - Presentation Tier Session bean - Business Tier Entity - Integration Tier I would say the console view is the presentation layer. What is stopping you from using a session bean in the console case? Maybe you are referring to this? Console - Presentation Tier POJO - Business Tier EJB3 (Hibernate?) support - Integration Tier If you want to hide the POJO EJB support interaction introduce a "workspace" persistance abstraction layer - this is where you would build your POJO repositories on. See Chapter 6: Preparing for Infrastructure That way you end up with: Console - Presentation Tier POJOs, Repositiories, Services - Business Tier Workspace PAL, EJB3 support - Integration Tier
|
"Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
I did not dismiss the possibility of using a session bean. I was just totally unsure of what pattern/style/design to use in this scenario. It is probably a common scenario. It is just new to me. The jsp-servlet-session bean-entity that I mentioned, most likely is based on the front controller patter; that is why there is an extra 'servlet/controller' mentioned. For this console system, is it like below? lets say I have 2 subsystems, Payment and Reservation: Payment presentation -- pojo Payment business class -- Payment processor/session bean -- entity Reservation presentation -- pojo Reservatioin business class -- Reservation processor/session bean -- entity
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
Or possibly: ================================================================ Payment presentation -- pojo Payment controller -- Payment business/session bean -- entity Reservation presentation -- pojo Reservatioin controller -- Reservation business/session bean -- entity ================================================================
|
 |
Peer Reynders
Bartender
Joined: Aug 19, 2005
Posts: 2906
|
|
The problem isn't here that the console view is that much different from a JSP view - they are both in the presentation layer. You are still trapped in the pre-EJB3 thinking of J2EE. The session bean is often nothing but a Transaction Script and the entity is nothing but an objectified database table or EQL/SQL query cursor row. This isn't very object-oriented even though everything is an Object. When you are working with POJOs the objects represent actual domain concepts that often require composite database rows and/or composite objects - POJOS are persistence ignorant (PI). In Domain Driven Design (DDD) terminology a POJO is an Entity if it has an identity - otherwise it is a Value Object (e.g. the Java Integer class). Usually each type of Entity POJO (or set of closely coupled POJOs) has its own Repository which is responsible for the management of the entities and the repository interacts with the persistance abstraction layer - there is no equivalent to J2EE entity beans. Business functionality that isn't covered by either the DDD Entities or Repositories is usually moved to Service. So the confusion has less to do with console versus JSP but more with POJO Domain objects versus the pre-EJB3 way of doing things.
|
 |
Peer Reynders
Bartender
Joined: Aug 19, 2005
Posts: 2906
|
|
more like: ================================================================ Payment transaction presentation -- Payment Repository -- persistence abstraction layer (work space using EJB3) Reservation transaction presentation -- Reservation Repository -- persistence abstraction layer (work space using EJB3) -- Credit Card Verification Service -- CC abstraction layer ================================================================ Transaction in the context of your domain rather than a database or distributed transaction. [ October 21, 2007: Message edited by: Peer Reynders ]
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
|
Thanks. I will share here once it is done. Ill post my design, and we can comment on it.
|
 |
Jesus Angeles
Ranch Hand
Joined: Feb 26, 2005
Posts: 2038
|
|
I didnt have time to improve my design. It is a small school homework. It turned out, that there is another front end to the same heart - web. DOS/Console----------------X session bean(transaction script)-----ejb3 persistence JSP---servlet(processor)---X session bean(transaction script)-----ejb3 persistence Both frontends communicated with the same X session bean. [ November 04, 2007: Message edited by: Jesus Angeles ]
|
 |
 |
|
|
subject: Pattern for DOS/console + Entity(ejb3)
|
|
|