Beispiel #1
0
  public void testCreateQueryObject() throws Exception {
    h.createStatement("insert into something (id, name) values (1, 'eric')").execute();
    h.createStatement("insert into something (id, name) values (2, 'brian')").execute();

    List<Map<String, Object>> results = h.createQuery("select * from something order by id").list();
    assertEquals(2, results.size());
    Map<String, Object> first_row = results.get(0);
    assertEquals("eric", first_row.get("name"));
  }
Beispiel #2
0
 public void testUsefulArgumentOutputForDebug() throws Exception {
   try {
     h.createStatement("insert into something (id, name) values (:id, :name)")
         .bind("name", "brian")
         .bind(7, 8)
         .bindFromMap(new HandyMapThing<String>().add("one", "two"))
         .bindFromProperties(new Object())
         .execute();
   } catch (StatementException e) {
     assertTrue(
         e.getMessage()
             .contains(
                 "arguments:{ positional:{7:8}, named:{name:'brian'}, finder:[{one=two},{lazy bean proprty arguments \"java.lang.Object"));
   }
 }