Indeed, both of these decisions are simply "blocked."
If you want to use an interface with a saved model type, write your code against JPA (if you are sure that it will return only to the relational database) or JDO (if you want to return to relational and other types of database, such as movement without SQL) . This is because with any of these solutions, if you encounter problems, you can switch persistence providers without rewriting the bulk of your code.
If you want to go with a procedural persistence model (directly related to SQL queries, etc.), go to JDBi or maybe even JDBC. JDBi provides a very good abstraction over JDBC; however, there are times when you want to access at a lower level (for performance reasons, for example, you set up queries and the database at a concert). Again, JDBC is a standard that makes it easy to swap one database for another; however, SQL itself will not be easy to replace.
To change the problems with replacing SQL, I recommend using a set of property files to store queries, and then a mechanisim resource loader type to bind SQL for the correct code database. It is not 100% reliable; but he is a little more than you.
Now, if you ask me what I will use, I highly recommend JDO.
source share