/** * Returns a set of properties if saving the bean will violate the unique constraints (defined by given properties). */ private Set<Property> checkUniqueness(EntityBean entityBean, BeanDescriptor<?> beanDesc, BeanProperty[] props, Transaction transaction) { BeanProperty idProperty = beanDesc.getIdProperty(); Query<?> query = new DefaultOrmQuery<>(beanDesc, this, expressionFactory); ExpressionList<?> exprList = query.where(); if (!entityBean._ebean_getIntercept().isNew()) { // if model is not new, exclude ourself. exprList.ne(idProperty.getName(), idProperty.getVal(entityBean)); } for (Property prop : props) { Object value = prop.getVal(entityBean); if (value == null) { return null; } exprList.eq(prop.getName(), value); } if (findCount(query, transaction) > 0) { Set<Property> ret = new LinkedHashSet<>(); Collections.addAll(ret, props); return ret; } return null; }
/** * Is not equal to. The same as <code>ne</code> but uses the strong type as argument rather than String. * * @param value the equal to bind value * @return the root query bean instance */ public final R notEqualToType(T value) { expr().ne(_name, value); return _root; }
/** * Is not equal to. * * @param value the equal to bind value * @return the root query bean instance */ public final R notEqualTo(T value) { expr().ne(_name, value); return _root; }
/** * Is not equal to. * * @param value the equal to bind value * @return the root query bean instance */ public final R ne(T value) { expr().ne(_name, value); return _root; }
/** * Is not equal to by ID property. */ public R notEqualTo(T other) { expr().ne(_name, other); return _root; }
break; case NE: peekExprList().ne(path, bind(value)); break; case INE:
/** * Returns a set of properties if saving the bean will violate the unique constraints (defined by given properties). */ private Set<Property> checkUniqueness(EntityBean entityBean, BeanDescriptor<?> beanDesc, BeanProperty[] props, Transaction transaction) { BeanProperty idProperty = beanDesc.getIdProperty(); Query<?> query = new DefaultOrmQuery<>(beanDesc, this, expressionFactory); ExpressionList<?> exprList = query.where(); if (!entityBean._ebean_getIntercept().isNew()) { // if model is not new, exclude ourself. exprList.ne(idProperty.getName(), idProperty.getVal(entityBean)); } for (Property prop : props) { Object value = prop.getVal(entityBean); if (value == null) { return null; } exprList.eq(prop.getName(), value); } if (findCount(query, transaction) > 0) { Set<Property> ret = new LinkedHashSet<>(); Collections.addAll(ret, props); return ret; } return null; }
break; case NE: peekExprList().ne(path, bind(value)); break; case INE: