I want to implement a sample in java that reads a configuration from some config file and, based on that, when user interacts with the page the application will store some data on either MySql or Oracle according to the configuration parameters. How can we implement this sample in most efficient and smart way?
Share
Indeed using Hibernate or JPA allows you to abstract the database differences away.
With a dependency injection framework like Spring or Guice you can then create 2 service instances which differ only in the persistence manager which is injected.
In this case you can keep almost 100% of the code identical for the 2 databases which guarantees they will not get out of sync over time.