Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
How (generally) do offer different persistence layers for an app?
So, I have used lots of apps (sorry, I'm talking a proper software system such as a Web based service (e.g. The Open Source XMPP server 'Openfire') in which you can choose what persistence back end you want (MySql or inbuilt H2/SQL light for example).
Within your code, how do you go about achieving this? Would you delegate the persistence to a separate class, and within that class figure out what the systems settings are and use the right connection string?
I'm currently using Java, Hibernate and would like to offer back ends of MySql, H2 and Redis, but the question is more conceptual than specific.
Many thanks.
question