final String sql = "INSERT INTO items (service, model, project, state, data, key, secret) VALUES (?, ?, ?, ?, ?, ?, ?)";
PreparedStatement ps = getJdbcConnection().prepareStatement(sql, new String[] { "id" });
ResultSet rs = null;
try {
ManagedItemState managedItemState = item.state;
setAtom(ps, 1, ServiceType.class);
setAtom(ps, 2, ItemType.class);
setAtom(ps, 3, ProjectId.class);
ps.setInt(4, managedItemState.getCode());
ps.setBytes(5, data);
ps.setString(6, item.getId());
ps.setBytes(7, secretData);
int updateCount = ps.executeUpdate();