예제 #1
0
 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();
   }
 }
예제 #2
0
 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();
   }
 }
예제 #3
0
 @Test
 public void testConnection() throws Exception {
   final SqlConnection connection = dataBaseManager.getConnectionProvider().obtainConnection();
   Assert.assertNotNull(connection);
   connection.commit();
 }