}
// Add some other records using the Record interface
final HBatch<HRecord> batch = conn.newHBatch();
for (int i = 5; i < 10; i++) {
HRecord rec = conn.getMapping("demo1").newHRecord();
rec.setCurrentValue("keyval", Util.getZeroPaddedNonNegativeNumber(i, 10));
rec.setCurrentValue("val1", "Value: " + i);
rec.setCurrentValue("f1:val2", i);
batch.insert(rec);
}
batch.apply();
// Query the records just added
HResultSet<HRecord> records = conn.executeQuery("SELECT * FROM demo1");
for (HRecord rec : records) {
System.out.println("Key = " + rec.getCurrentValue("keyval"));
System.out.println("f1:val1 = " + rec.getCurrentValue("val1"));
System.out.println("f1:val2 = " + rec.getCurrentValue("f1:val2"));
System.out.println("f1:val3 = " + rec.getCurrentValue("f1:val3"));
}
stmt.close();
// END SNIPPET: definedExample1