Hi Ilia,
The Interface you describe comes very close to the OJB Interface
PersistenceBroker:
http://db.apache.org/ojb/api/org/apache/ojb/broker/PersistenceBroker.html
As The Beer4all example is meant as a simple Struts + OJB tutorial there is
no need to introduce an additional service interface.
Of course, if you plan to plug in different o/r tools it makes sense to
introduce such an additional layer of abstraction!
In my company we are using such an abstracted persistence service interface
to allow our customers to choose between OJB and TopLink! (Of course most of
our customers are happy with OJB ;-))
ODMG and JDO are also persistence layer abstractions, so they could also be
a natural fit for such an approach!
cheers,
Thomas
> Hi
>
> When reading the beer4all example, I remark that the use of
> OJB is done in
> the service layer.
> My question is:
> Why there is no separated persistence layer that can be
> implemented by OJB
> (or other)?
> Can't we make, in OJB, an implementation of an interface like
>
>
> public interface PersistenceService {
>
> public Object getObjectById(int id);
>
> public Collection getCollectionById(int id);
>
> public Object getObjectByCriteria(Object criteria);
>
> public Collection getCollectionByCriteria(Object criteria);
>
> public Object getObjectForUpdate(Object criteria);
>
> public void updateObject(Object o);
>
> public void updateCollection(Collection o);
>
> public void createObject(Object o);
>
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]