public < S extends Model > ResultKey save ( S model ) { List < Object > columnValues = AnimaUtils . toColumnValues ( model , true ) ; String sql = this . buildInsertSQL ( model , columnValues ) ; Connection conn = getConn ( ) ; try { List < Object > params = columnValues . stream ( ) . filter ( Objects :: nonNull ) . collect ( toList ( ) ) ; return new ResultKey ( conn . createQuery ( sql ) . withParams ( params ) . executeUpdate ( ) . getKey ( ) ) ; } finally { this . closeConn ( conn ) ; this . clean ( conn ) ; } }
Save a model