Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void insert(Chat entity) {
- String query = "insert into chats (" + fields + ") values (?, ?, ?, ?, ?)";
- jdbcTemplate.execute(query, new PreparedStatementCallback<Object>() {
- @Override
- public Object doInPreparedStatement(PreparedStatement ps) throws SQLException, DataAccessException {
- ps.setObject(1, entity.getId());
- ChatType type = entity.getType();
- ps.setInt(2, type.ordinal());
- if (type == ChatType.GROUP) {
- ps.setString(3, entity.getName().get());
- ps.setObject(4, entity.getOwner().get());
- ps.setInt(5, entity.getGroupChatVisibility().get().ordinal());
- }
- return null;
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement