0

I am using javax CriteriaBuilder with CriteriaQuery like this:

CriteriaBuilder builder = getSession().getCriteriaBuilder();
CriteriaQuery<MyClazz> criteria = builder.createQuery(MyClazz.class);
Root<MyClazz> root = criteria.from(MyClazz.class);
Predicate predicate = builder.and(
                            builder.equal( root.get("attribute1"), "somestring");
                    );
criteria.select(root).where(predicate);
Query<MyClazz> query = getSession().createQuery(criteria);

The thing is that "attribute1" has length ~20. I dont want to compare full attribute1 length, i just want records WHERE attribute1 on position [5,16] equals "somsetring". Is there any way to achieve this?

Michael
  • 33
  • 5

0 Answers0