I had a look through your code and I cannot recommend anybody use it.
Here's my analysis:
The code doesn't conform to a standard and doesn't follow any patterns. This makes the codebase very hard to manage and maintain.
There is no support for aggregate functions so for those who want to do more than just a simple select, you won't be able to.
There is also bad code littered everywhere, take the following method:
This function catches the exception and returns null. A person running this in production won't know an exception has occurred until its too late (especially if the object is created on-demand). Whilst it's okay in development to print a stack trace, you should perhaps add appropriate logging and exception handling (such as retry if the host cannot be reached).Code:public DBConnection createConnectionPool(String schema) { String host = properties.getProperty("db-host"); String port = properties.getProperty("db-port"); String user = properties.getProperty("db-user"); String pass = properties.getProperty("db-pass"); PoolableObjectFactory objectFactory = new ConnectionPoolFactory(host, Integer.parseInt(port), schema, user, pass); GenericObjectPool.Config config = new GenericObjectPool.Config(); config.maxActive = 10; config.testOnBorrow = true; config.testWhileIdle = true; config.timeBetweenEvictionRunsMillis = 10000; config.minEvictableIdleTimeMillis = 60000; GenericObjectPoolFactory genericObjectPoolFactory = new GenericObjectPoolFactory(objectFactory, config); ObjectPool pool = genericObjectPoolFactory.createPool(); factories.put(schema, pool); try { return new DBConnection(schema, pool); } catch (Exception e) { e.printStackTrace(); } return null; }
There is impractical attempt at having classes representing objects in a database. Once you create a Player object (as per your example), there's no way without seeing the stack trace if an error occurred. What if in your local dev environment it works but fails in prod intermittently? To save a Player, you don't provide a way to save the Player the same way you retrieved it. Instead it seems like you're making the developer write the query themselves.
There's loads of other things but these are the ones that stood out.
Also this isn't a tutorial.