I am implementing a layered architecture application and I access various data sources depending on operation ranging from web services, rdbms, active directories and xml data bases and sometimes I access 2 different data sources in the same operation(method call). I want to implement DAOs based on a common DAO interface so I can acheive loose coupling between the DAO and the business layer. The concern that I have is that not all DAOs will implement all the functionality defined in the interface, so I will end up with some DAOs with empty implimentations. How do you guys tackle this challenge?
Thanks,
Shepard
-
Generic Pluggable DAO Pattern Implementation (1 messages)
- Posted by: Shapiro Test
- Posted on: March 25 2004 23:38 EST
Threaded Messages (1)
- Generic Pluggable DAO Pattern Implementation by Tomas Inger on March 26 2004 03:16 EST
-
Generic Pluggable DAO Pattern Implementation[ Go to top ]
- Posted by: Tomas Inger
- Posted on: March 26 2004 03:16 EST
- in response to Shapiro Test
Hi!
My recommendation is to use the UnsupportedOperationException from the java.lang package. It is better to get a runtime exception and notice the problem (even in production), than just fall through an empty implementation.
I you have empty implementations when an operation is not supported, you will end up in a code where strange things will happen and it will be really hard to debug. Don't to that!
/Tomas