> My question is if there are any good patterns for separating the core
> business objects from their data representation stored in the
> database. I
> imagine two classes, say Horse and HorseData. Is there a good
> pattern for
> this separation preferable with a rather loose coupling.

Hi Bengt,

Separating your business logic from data logic is a common situation in a
"brew it yourself" business system without an application server [i've bean
there... ;groan; <grin> ] I believe one of the strengths of EJB is to
encourage the application designer to ignore the trade-offs involved when
designing a logic/data delegation split - the split is done for you in the
spec.

Of course, EJB servers/tools do vary in their ability to serve up entity vs.
session beans, and often lack the tools to do complex mapping to entity
beans, so your question is a good one...

IMHO, EJB effectively designs this split for you:  entity beans represent a
specific instance of a shared resource, such as a normalized database table.
They include low-level/simple business logic that is specific to that bean's
role.  Session beans act as "facades" for the entity beans in that they
provide the top-level business processes that your client would interact
with.

Other non-ejb business servers (WebObjects' enterprise object framework, for
instance) work in a way similar to the above (though the terminology, and
what goes on underneath the covers, varies)..

The trick here is to find a suitable object/relational mapping tool for your
entity beans if you feel the underlying database is too complicated for the
current generation of CMP servers out there.  In this way BMP could be
used... However, note that I think that you probably STILL could use CMP if
you used one of the "odbms"-like EJB servers like Gemstone or Persistence,
coupled with an OR-mapping to synchronize your data with the RDBMS.  In this
way, your performance won't be hindered by complex dynamic-SQL - the
underlying object cache helps a ton.

I hope this helps a bit.. (even if it is a bit "hand wavy" :)

- Stu
Systems Architect, Nuvation Labs

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to