Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes Some thoughts about abstracting everything from everything Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Some thoughts about abstracting everything from everything" Watch "Some thoughts about abstracting everything from everything" New topic
Author

Some thoughts about abstracting everything from everything

Oleg Puzanov
Greenhorn

Joined: Jul 19, 2007
Posts: 2
Hello,

For the last 3-4 months I've been picking JBoss Seam as the framework for my Java EE projects,
before this I was using some plain EJB3 + JPA approaches.
The overall stack of technologies looks like this (from Presentation Tier downto Resource Tier):

RichFaces
|
Facelets
|
JSF
|
EJB3
|
JPA


....with Seam being present somewhere throughout all these technologies.

Everything seems to be cool - the need for introducing some "glueing" components such as DAOs, DTOs, Service Locators etc.
seems to evaporate and all layers seem to cooperate pretty much well. BUT....
I really need (have) to keep a certain level of independence and loose coupling among the technologies used throughout the application tiers.
To my opinion the main issue with JBoss Seam seems to be the following:

1. The common practices assume the presence of Seam-specific annotations and JPA invocations in Session Beans,
which are being later called by JSF

2. Considering that Session Beans contain almost all the business logic of our application (for the case of Seam application),
this means that this business logic is coupled with both Seam by using at least its context management services
(e.g. @In @Out annotations for injecting/outjecting Seam components) and JPA by calling EntityManager methods directly
inside the methods of Session Beans


What I really need (have to) is the following:

1. Independence from the technologies in Persistence Layer (EIS Integration Tier):
My "data feeders" can be anything the human mind can imagine: RDBMS, XML Database, Plain Files, Legacy Systems via Proprietary Protocols etc.

2. Independence from Seam in my CORE business logic.

3. At the same time - keeping all the infrastructural services provided by Seam and EJB3


From my side I can suggest the following solution to this architectural problem:

1. To keep Session Bean sublayer dependent on Seam - there is no other way out,
I will call this sublayer "Seam Business Logic Integration Layer".
It's main purpose will be to integrate Business Logic Tier with Seam and EJB3 infrastructural services.

2. To move the core business logic into POJI/POJO implementations,
which will not use Seam/EJB3 annotations or other services + they will also not use JPA invocations.
Considering that we will not use @Name annotation for these POJOs and
that we will still need to inject them into Session EJBs, all these POJOs will be configured in components.xml as Seam components.

3. To introduce something called "Domain Model Facade" - abstraction from the underlying persistence technologies.
This facade will be presented as POJI for the core business logic (implemented as POJOs) and will provide
the basic methods related to data access operations (e.g. save, load, find etc.).
The underlying implementations will provide JPA, XML or JCA versions according to the configurations.
I will call this sublayer "Seam Domain Model Integration Layer".

4. Domain Model itself will be exposed to the core business logic as POJI/POJO combinations.
While at the same time - these classes can be configured in components.xml as Seam components
for enabling the context management services provided by Seam + referencing them in JSF pages.


What I really want to ask is the following:

1. Will this work?

2. For the case if it will work - maybe there are some existing and better approaches to this issue?
For example: something with Spring integration into all this mess for enabling the loose coupling between layers?
Or maybe it will introduce some much bigger mess...

Thanks in advance,
Oleg


SCJP 5.0, SCWCD 1.4, SCBCD 5.0, SCMAD, SCEA (Part 1), MCP (70-316), MCP (70-300)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Some thoughts about abstracting everything from everything
 
Similar Threads
distinctions between Stateless and Stateful bean
JPA and tier separation
Pattern for DOS/console + Entity(ejb3)
JEE5 Application Architecture Best Practice.
Business Logic in EJB3 SessionBean?