예제 #1
0
  // On teste un preparestatement mappé sur un type dynamique DTList.
  @Test
  public void testDynSelect() throws Exception {
    // On crée les données
    createDatas();
    // ----
    final Domain domain = new Domain("DO_TEST", DataType.DtList);
    final SqlQueryResult result = executeQuery(domain, "select * from movie");

    Assert.assertEquals(3, result.getSQLRowCount());
    final DtList<DtObject> dynMovies = (DtList<DtObject>) result.getValue();
    Assert.assertEquals(3, dynMovies.size());

    for (final DtObject dynMovie : dynMovies) {
      final long id = (Long) getValue(dynMovie, "ID");
      final String title = (String) getValue(dynMovie, "TITLE");
      checkTitle(id, title);
    }
  }
예제 #2
0
  // On teste un preparestatement mappé sur un type statique (Class famille)
  @Test
  public void testSelectList() throws Exception {
    // On crée les données
    createDatas();
    // ----
    final Domain domain = Home.getDefinitionSpace().resolve("DO_DT_MOVIE_DTC", Domain.class);
    final SqlQueryResult result = executeQuery(domain, "select * from movie");

    Assert.assertEquals(3, result.getSQLRowCount());

    final DtList<Movie> movies = (DtList<Movie>) result.getValue();
    Assert.assertEquals(3, movies.size());

    for (final Movie movie : movies) {
      final long id = movie.getId();
      final String title = movie.getTitle();
      checkTitle(id, title);
    }
  }