@Test public void testSave() { System.out.println("save"); JDBCSessionDataStorage instance = new JDBCSessionDataStorage(dataSource); SessionData sessionData = instance.create(); String sessionId = sessionData.getId(); sessionData.put(KEY, VALUE); instance.save(sessionData); SessionData saved = instance.get(sessionId); assertEquals(sessionData, saved); String value1 = sessionData.get(KEY); String value2 = saved.get(KEY); assertEquals(value1, value2); }
@Override public void save(SessionData sessionData) { String id = sessionData.getId(); Timestamp time = new Timestamp(System.currentTimeMillis()); String data = transcoder.encode(sessionData); if (executeUpdate(update, time, data, id) == 0) { executeUpdate(insert, id, time, data); } }
JDBCSessionDataStorage implements SessionDataStorage { @Override public void save(SessionData sessionData) { String id = sessionData.getId(); Timestamp time = new Timestamp(System.currentTimeMillis()); String data = transcoder.encode(sessionData); if (executeUpdate(update, time, data, id) == 0) { executeUpdate(insert, id, time, data); } } }
JDBCSessionDataStorage implements SessionDataStorage { @Override public void save(SessionData sessionData) { String id = sessionData.getId(); Timestamp time = new Timestamp(System.currentTimeMillis()); String data = transcoder.encode(sessionData); if (executeUpdate(update, time, data, id) == 0) { executeUpdate(insert, id, time, data); } } JDBCSessionDataStorage(DataSource dataSource);  JDBCSessionDataStorage(DataSource dataSource, String select, String insert, String update, String delete);  JDBCSessionDataStorage(DataSource dataSource, String select, String insert, String update, String delete, SessionDataTranscoder transcoder); }
JDBCSessionDataStorage implements SessionDataStorage { @Override public void save(SessionData sessionData) { String id = sessionData.getId(); Timestamp time = new Timestamp(System.currentTimeMillis()); String data = transcoder.encode(sessionData); if (executeUpdate(update, time, data, id) == 0) { executeUpdate(insert, id, time, data); } } JDBCSessionDataStorage(DataSource dataSource);  JDBCSessionDataStorage(DataSource dataSource, String select, String insert, String update, String delete);  JDBCSessionDataStorage(DataSource dataSource, String select, String insert, String update, String delete, SessionDataTranscoder transcoder); @Override SessionData create(); @Override void save(SessionData sessionData); @Override SessionData get(String sessionId); @Override void delete(String sessionId); }
JDBCSessionDataStorage implements SessionDataStorage { @Override public void save(SessionData sessionData) { String id = sessionData.getId(); Timestamp time = new Timestamp(System.currentTimeMillis()); String data = transcoder.encode(sessionData); if (executeUpdate(update, time, data, id) == 0) { executeUpdate(insert, id, time, data); } } JDBCSessionDataStorage(DataSource dataSource);  JDBCSessionDataStorage(DataSource dataSource, String select, String insert, String update, String delete);  JDBCSessionDataStorage(DataSource dataSource, String select, String insert, String update, String delete, SessionDataTranscoder transcoder); @Override SessionData create(); @Override void save(SessionData sessionData); @Override SessionData get(String sessionId); @Override void delete(String sessionId); static final String SELECT; static final String INSERT; static final String UPDATE; static final String DELETE; }