@Test public void testUpdate_DateTime_ZoneAware() { jdbcTemplate.update("DELETE from date_time"); TimeZone.setDefault(TimeZone.getTimeZone(ZoneId.of("Asia/Tokyo"))); DateTimeEntity entity = new DateTimeEntity(); entity.utilDate = java.util.Date.from(LocalDateTime.of(2001, 1, 23, 12, 34, 56, 789000000).atZone(ZoneId.systemDefault()).toInstant()); entity.sqlDate = java.sql.Date.valueOf(LocalDate.of(2001, 1, 24)); entity.sqlTime = java.sql.Time.valueOf(LocalTime.of(12, 34, 57)); entity.sqlTimestamp = Timestamp.valueOf(LocalDateTime.of(2001, 1, 25, 12, 34, 58, 789000000)); entity.localDateTime = LocalDateTime.of(2001, 1, 26, 12, 34, 59, 789000000); entity.localDate = LocalDate.of(2001, 1, 27); entity.localTime = LocalTime.of(12, 35, 1); entity.zonedDateTime = LocalDateTime.of(2001, 1, 28, 12, 35, 2, 789000000).atZone(ZoneId.systemDefault()); entity.offsetDateTime = LocalDateTime.of(2001, 1, 29, 12, 35, 3, 789000000).atOffset(ZoneId.systemDefault().getRules().getOffset(Instant.now())); entity.offsetTime = LocalTime.of(12, 35, 4).atOffset(ZoneId.systemDefault().getRules().getOffset(Instant.now())); SqlTemplate template = new SqlTemplate(jdbcTemplate, namedParameterJdbcTemplate, ZoneId.of("GMT")); int num = template.query("INSERT INTO date_time VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)") .args(entity.utilDate, entity.sqlDate, entity.sqlTime, entity.sqlTimestamp, entity.localDateTime, entity.localDate, entity.localTime, entity.zonedDateTime, entity.offsetDateTime, entity.offsetTime) .update(); assertEquals(1, num); DateTimeEntity result = template.query("SELECT * FROM date_time").forObject(DateTimeEntity.class); assertEquals("2001-01-23 12:34:56.789", result.utilDate.toString()); assertEquals("2001-01-24", result.sqlDate.toString()); assertEquals("12:34:57", result.sqlTime.toString()); assertEquals("2001-01-25 12:34:58.789", result.sqlTimestamp.toString()); assertEquals("2001-01-26T12:34:59.789", result.localDateTime.toString()); assertEquals("2001-01-27", result.localDate.toString()); assertEquals("12:35:01", result.localTime.toString()); assertEquals("2001-01-28T03:35:02.789Z[GMT]", result.zonedDateTime.toString()); assertEquals("2001-01-29T03:35:03.789Z", result.offsetDateTime.toString()); assertEquals("03:35:04Z", result.offsetTime.toString()); }
public ArrayBuilder query(String query) { return new ArrayBuilder(jdbcTemplate, namedJdbcTemplate, paramBuilder, mapperBuilder, TemplateEngine.PLAIN_TEXT, query); }
SqlTemplate { public ArrayBuilder query(String query) { return new ArrayBuilder(jdbcTemplate, namedJdbcTemplate, paramBuilder, mapperBuilder, TemplateEngine.PLAIN_TEXT, query); } }
SqlTemplate { public ArrayBuilder query(String query) { return new ArrayBuilder(jdbcTemplate, namedJdbcTemplate, paramBuilder, mapperBuilder, TemplateEngine.PLAIN_TEXT, query); } SqlTemplate(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate);  SqlTemplate(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate, ZoneId zoneId);  SqlTemplate(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate, ParamBuilder paramBuilder, MapperBuilder mapperBuilder); }
SqlTemplate { public ArrayBuilder query(String query) { return new ArrayBuilder(jdbcTemplate, namedJdbcTemplate, paramBuilder, mapperBuilder, TemplateEngine.PLAIN_TEXT, query); } SqlTemplate(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate);  SqlTemplate(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate, ZoneId zoneId);  SqlTemplate(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate, ParamBuilder paramBuilder, MapperBuilder mapperBuilder); ArrayBuilder file(String filename); ArrayBuilder query(String query); BatchBuilder batchUpdate(); }
SqlTemplate { public ArrayBuilder query(String query) { return new ArrayBuilder(jdbcTemplate, namedJdbcTemplate, paramBuilder, mapperBuilder, TemplateEngine.PLAIN_TEXT, query); } SqlTemplate(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate);  SqlTemplate(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate, ZoneId zoneId);  SqlTemplate(JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedJdbcTemplate, ParamBuilder paramBuilder, MapperBuilder mapperBuilder); ArrayBuilder file(String filename); ArrayBuilder query(String query); BatchBuilder batchUpdate();  }