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

In what tier to put O/R mapping?

 
David Follow
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

in my design, the business logic (simple Java objects used by session beans) use a technology-independent interface to persist data. A factory instanciates a concrete implementation of the interface.

Currently, the technologie-independent interface is implemented using CMP2.0. Both, the interface/factory and the CMP2.0 classes reside in the business-tier since EJBs belong to the business-tier.

Now, I am wondering what will happen, if a different O/R mapping technology (such as JDO or Hibernate) will be used to implement the above interface? Will this implementation still reside in the business-tier or will it be moved to the integration-tier?

First I thought it goes to the integration-tier since I "integrate" with the database. But now I am not so sure anymore, since it would be kind of asymetric to the CMP2.0 approach which lives in the business-tier.

Any thought will be appreciated!

D.
 
David Follow
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I guess I came up with a good solution for the problem.
The business interface to the persistence resides in the business tier,
but the e.g. Hibernate or JDO implementation of the interface resides in the integration tier.
For CMP however, the interface as well as the implementation resides in the business tier. Which implementation of the interfaces to instanciate is decided by a factory - which also lives in the business tier.

Does that sound OK to you all?

D.
 
jason white
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,

Your implementation makes sound sense, having done some hibernate work recently.

I think though that this might be a risky approach to take on the exam.

Others have asked about using hibernate spring, eliminating entity beans etc...

The general feeling is that straying from j2ee principles into open source land is something that might cause you to fail the exam.. This is all based on the instructions for the exam stating you must use technologies from the J2EE environment.

While I know Hibernate etc is a great, great, great way of doing the implementation, it doesn't so much pertain to the assignment...

If I were you, I might look more into Mark Cade's book and see how he implements a DAO/VO pattern..This would be a more acceptable approach to Sun I think since VO's can map to EJB's etc..

Any other thoughts?

-jason
 
David Follow
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jason,

I didn't plan on using Hibernate. I was just looking for a solution that possibly hides the persistence implementation. For the assignment the implementation will be CMP, but for design purposes it is hidden behind a technology-free interface. There the fragile persistence approach can be swapped out in the future (to e.g. Hibernate, EJB3, JDO...you name it).

D.
 
leevisa asinveel
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a good architecture, SUBSYSTEMS are highly decoupled and classes inside a SUBSYTSEM are closely related to have maximum COHESION. This we need to achieve in our architecture and design.
What i understood from the thread is, u want your SESSION FACADE to choose and work between different DATA ACCESS MECHANISM exposing a single interface, this is a good input for choosing a pattern like STATERGIC. But this should not impact tiers.All the mentioned techs (HIBERNATE or JDO or TOPLINK) are data access mechanisms may have common INTERFACE to decouple. I always go with Integration Tier as my choice for DATA ACCESS irrespective of what TECH to implement it.
I do not think we need to document or specify much about this in PART 2.

vijay s
SJCP4,SCEA
 
jason white
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,

I used a "Processor" approach where my Processor class is an EJB with BMP.

Probably doesn't answer your question I am sure but thought I would share.

-jason
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic