Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

About Martin Fowler's Data Mapper pattern

843830Jul 12 2008
As mentioned in his book, Data Mapper is a layer to hide database access from domain objects. It also recommended that data mapper shouldn't be exposed to domain layer.

However, as I've experienced, most of my domain logic involves database access so I have to expose my data mapper to domain layer.

I know that I can make interfaces to avoid referencing data mapper directly, but it doesn't make sense to me. If you have a DataMapper with "void updateData()" method, why whould you make an interface with "void updateData()" and get the DataMapper to implement this interface? I think it's totally unnecessary. Could someone comment on this?

So my conclusion is that data mapper can't be hiddent from domain logics (in most cases). right?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 9 2008
Added on Jul 12 2008
0 comments
305 views