Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What pattern fits between a façade and a DAO?

I'm in the process of designing part of my companies architecture for its Java EE web applications. I'm pretty clear on the reasons to use a façade and one or more DAOs. The problem I have is this:

There will be some logic that definitely belongs in the integration tier because it's all about keeping the data model consistent. Except the logic goes beyond simply maintaining referential integrity and other 'raw' persistence tasks which will be handled by JPA and Hibernate. I don't class this as business logic because it's separate to any business function. However, my understanding is that a DAO should only implement the logic required to access and persist objects to the data source.

My conclusion is that I need a 'business object'-like pattern which is appropriate for the integration tier. I've looked around and the closest thing I have found (yet still not quite right to my mind) is the Sun Transfer Object Assembler pattern.

Either there's a gap in my understanding of Java EE or there is a pattern out there that will fit.

like image 307
James Watt Avatar asked Dec 02 '09 12:12

James Watt


1 Answers

maybe a mediator is what you want:

Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.

then you can use a DaoMediator in order to coordinate two or more DAOs

like image 131
dfa Avatar answered Oct 01 '22 02:10

dfa