Hi All

I just wondered how others are implementing their persistence layers using
OJB?

This is what I am looking at doing at the moment but I am wondering whether
or not it makes sense?

I have a Data Access Class (DAO) that provides access to a Data Transfer
Object (DTO) like:

CustomerDAO with methods insert(CustomerDTO), update(CustomerDTO),
getByName(String) etc.

So the way I am viewing it is, any returned object from the CustomerDAO
would be a DTO.  And anything passed to it would be a DTO.

Within the CustomerDAO, any interaction with OJB (FYI using ODMG) is done
via BusinessObjects.

So a getByName(String) will query the database using OJB, return a
CustomerBusinessObject to the CustomerDAO which will populate a CustomerDTO
and return it to caller.

An insert with provide a CustomerDTO to the CustomerDAO which will inturn
create a CustomerBusinessObject and persist it.

An update will provide a CustomerDTO to the CustomerDAO which will inturn
get the existing CustomerBusinessObject, update it from the CustomerDTO and
persist the changes.

Does this sound reasonable?  

It just seems like an awful lot of "copying" that becomes quite difficult
when an Object contains a collection of other Objects.  

I have been using the BeanUtils.copyProperties() method to do my copying but
when it come to a collection I have to iterate through it otherwise the
objects within the collection of the new DTO object [like returned in
getByName()] would contain references to BusinessObjects and not DTO's.

Any thoughts or comments?

Cheers
Shane

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to