0

I am working on a java application which is loading data from one database to another database now according to client requirement

Tool has to load data from one database to another now with other technology

Now the source database is Postgres and previously it is Oracle in future it may be sql server , As if now the target database is postgres only.

We are thinking to use AdapterFactory pattern

Condition is like that

We have a class that is used to produce data say DataProducer and we have a class which consume data say DataConsumer Now both these classes have some functionality that are database related such as package are not avaliable in postgres so we are making a seperate workaround for that type of code . and we have some code that can be used for both database . such as truncate table .

What we are planning is to make a interface each for DataProducer and DataConsumer and make a Base abstract class each for DataProducer and DataConsumer and have common mehod in Base class and specific Methods in the implementation class like PGDataConsumer and OracleDataConsumer

4
  • You could consider a FactoryPattern Commented Nov 25, 2014 at 5:52
  • how it is usefull @MadProgrammer Commented Nov 25, 2014 at 5:53
  • Basically, you code to interface, you design factories which manage instances of theses interfaces, you don't care how they are created, only that they conform to the interface requirements. The factories then become replaceable/configurable, so you can swap out the implementations without effecting the rest of the code...me thinks you might need a combination of patterns... Commented Nov 25, 2014 at 5:55
  • i have edited my question and have given details . @MadProgrammer is this a good design?? Commented Nov 25, 2014 at 6:04

1 Answer 1

1

Adapter Factory is a good pattern . Since you are more interested in making things generic to access various databases , a good choice would be a DAO pattern with spring framework

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.