Java Code Examples for javax.persistence.criteria.CriteriaBuilder.literal()

The following are Jave code examples for showing how to use literal() of the javax.persistence.criteria.CriteriaBuilder class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: sucok-framework   File:   Source Code and License Vote up 6 votes
@SuppressWarnings({ "rawtypes", "unchecked" })
public Predicate buildJpaPredicate(CriteriaBuilder cb, Root root) {
	String field1 = (String) Array.get(value, 0);
	String field2 = (String) Array.get(value, 1);
	Expression<Comparable> path1 = QueryFormHelper.getPath(root, field1);
	Expression<Comparable> path2 = QueryFormHelper.getPath(root, field2);
	Expression<Comparable> parameter = cb.literal((Comparable) value);
	return cb.between(parameter, path1, path2);