.add( Example.create(m).excludeProperty("bigDecimal") ) .createCriteria("otherMaster") .add( Example.create(m).excludeZeroes().excludeProperty("bigDecimal") ) .uniqueResult(); assertTrue( m1.getOtherMaster()==m1 );
list = s.createCriteria(Foo.class).add( Example.create(example) .excludeZeroes() .ignoreCase() .excludeProperty("bool") .excludeZeroes() .enableLike(MatchMode.ANYWHERE) .excludeProperty("bool")
@Override @SuppressWarnings("unchecked") public List<ISoapBoxEntity> find(ISoapBoxEntity entity) { EntityManager manager = ConnectionDB.getManager(); manager.clear(); Session sessao = (Session) manager.getDelegate(); Example example = Example.create(entity); example.excludeZeroes(); Criteria criteria = sessao.createCriteria(entity.getClass()); criteria.add(example); return criteria.list(); }
protected Example createExample() { return Example.create(exampleInstance).excludeZeroes().ignoreCase().enableLike(); }
@Override public <T extends Entity, E extends T> List<T> findByExample(final E example, final ExampleSettings<T> settings) { Example theExample = Example.create(example); if (settings.isLikeEnabled()) { theExample.enableLike(MatchMode.ANYWHERE); } if (settings.isIgnoreCaseEnabled()) { theExample.ignoreCase(); } if (settings.isExcludeNone()) { theExample.excludeNone(); } if (settings.isExcludeZeroes()) { theExample.excludeZeroes(); } for (String propName : settings.getExcludedProperties()) { theExample.excludeProperty(propName); } return getSession().createCriteria(settings.getEntityClass()).add(theExample).list(); }