private SqlQueryResult executeQuery(final Domain domain, final String sql)
     throws SQLException, Exception {
   final SqlConnection connection = dataBaseManager.getConnectionProvider().obtainConnection();
   try (final SqlPreparedStatement preparedStatement =
       dataBaseManager.createPreparedStatement(connection, sql, false)) {
     preparedStatement.init();
     return preparedStatement.executeQuery(domain);
   } finally {
     connection.commit();
   }
 }
 private void execCallableStatement(final SqlConnection connection, final String sql)
     throws SQLException {
   final SqlCallableStatement callableStatement =
       dataBaseManager.createCallableStatement(connection, sql);
   callableStatement.init();
   callableStatement.executeUpdate();
 }
 public void createDatas() throws Exception {
   final SqlConnection connection = dataBaseManager.getConnectionProvider().obtainConnection();
   try {
     execCallableStatement(connection, "insert into movie values (1, 'citizen kane')");
     // -----
     execCallableStatement(connection, "insert into movie values (2, 'vertigo')");
     // -----
     // On passe par une requête bindée
     insert(connection, 3, TITLE_MOVIE_3);
   } finally {
     connection.commit();
   }
 }
 private void insert(final SqlConnection connection, final long key, final String libelle)
     throws SQLException {
   final String sql = "insert into movie values (?, ?)";
   try (final SqlCallableStatement callableStatement =
       dataBaseManager.createCallableStatement(connection, sql)) {
     callableStatement.registerParameter(0, DataType.Long, true);
     callableStatement.registerParameter(1, DataType.String, true);
     // -----
     callableStatement.init();
     // -----
     callableStatement.setValue(0, key);
     callableStatement.setValue(1, libelle);
     // -----
     callableStatement.executeUpdate();
   }
 }
 @Test
 public void testConnection() throws Exception {
   final SqlConnection connection = dataBaseManager.getConnectionProvider().obtainConnection();
   Assert.assertNotNull(connection);
   connection.commit();
 }
 @Override
 protected void doTearDown() throws Exception {
   // A chaque fin de test on arrête la base.
   final SqlConnection connection = dataBaseManager.getConnectionProvider().obtainConnection();
   execCallableStatement(connection, "shutdown;");
 }
 @Override
 protected void doSetUp() throws Exception {
   // A chaque test on recrée la table famille
   final SqlConnection connection = dataBaseManager.getConnectionProvider().obtainConnection();
   execCallableStatement(connection, "create table movie(id BIGINT , title varchar(255));");
 }