@Test public void testService_Update_AllColumns() throws Exception { createDatabase(CREATE_ALL_BASIC_TYPES); populateDatabase(INSERT_STMT_ALL_TYPES); UpsertProperties service = configureForTests(createService()); KeyValuePairSet mappings = new KeyValuePairSet(); mappings.add(new KeyValuePair("firstname", JdbcMapInsert.BasicType.String.name())); mappings.add(new KeyValuePair("lastname", JdbcMapInsert.BasicType.String.name())); mappings.add(new KeyValuePair("dob", JdbcMapInsert.BasicType.Date.name())); mappings.add(new KeyValuePair("integerColumn", JdbcMapInsert.BasicType.Integer.name())); mappings.add(new KeyValuePair("longColumn", JdbcMapInsert.BasicType.Long.name())); mappings.add(new KeyValuePair("booleanColumn", JdbcMapInsert.BasicType.Boolean.name())); mappings.add(new KeyValuePair("bigIntegerColumn", JdbcMapInsert.BasicType.BigInteger.name())); mappings.add(new KeyValuePair("bigDecimalColumn", JdbcMapInsert.BasicType.BigDecimal.name())); mappings.add(new KeyValuePair("floatColumn", JdbcMapInsert.BasicType.Float.name())); mappings.add(new KeyValuePair("doubleColumn", JdbcMapInsert.BasicType.Double.name())); mappings.add(new KeyValuePair("timestampColumn", JdbcMapInsert.BasicType.Timestamp.name())); mappings.add(new KeyValuePair("timeColumn", JdbcMapInsert.BasicType.Time.name())); service.setFieldMappings(mappings); service.setIdField(ID_ELEMENT_VALUE); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(CONTENT_ALL_TYPES); ExampleServiceCase.execute(service, msg); doAssert(1); checkDob(ALICE, DOB); try (Connection c = createConnection(); Statement s = c.createStatement(); ResultSet rs = s.executeQuery(String.format(SELECT_STMT, TABLE_NAME, ALICE))) { if (rs.next()) { assertEquals(true, rs.getBoolean("booleanColumn")); } else { fail("No Match for firstname: " + ALICE); } } }
public void setIdField(String elem) { this.idField = elem; }
JdbcMapUpsert extends JdbcMapInsert { public void setIdField(String elem) { this.idField = elem; } }
JdbcMapUpsert extends JdbcMapInsert { public void setIdField(String elem) { this.idField = elem; } JdbcMapUpsert(); }
JdbcMapUpsert extends JdbcMapInsert { public void setIdField(String elem) { this.idField = elem; } JdbcMapUpsert(); String getIdField(); void setIdField(String elem); T withId(String elem); }
JdbcMapUpsert extends JdbcMapInsert { public void setIdField(String elem) { this.idField = elem; } JdbcMapUpsert(); String getIdField(); void setIdField(String elem); T withId(String elem); static final String DEFAULT_ID_FIELD; }