Example usage for javax.persistence.criteria Path getModel

List of usage examples for javax.persistence.criteria Path getModel

Introduction

In this page you can find the example usage for javax.persistence.criteria Path getModel.

Prototype

Bindable<X> getModel();

Source Link

Document

Return the bindable object that corresponds to the path expression.

Usage

From source file:com.dbs.sdwt.jpa.ByExampleUtil.java

public <E> Predicate byExampleOnEmbeddable(Path<E> embeddablePath, E embeddableValue, SearchParameters sp,
        CriteriaBuilder builder) {// ww w . j a va2  s  .  c  o m
    if (embeddableValue == null) {
        return null;
    }

    Class<E> type = embeddablePath.getModel().getBindableJavaType();
    ManagedType<E> mt = em.getMetamodel().embeddable(type); // note: calling .managedType() does not work

    return jpaUtil.andPredicate(builder, byExample(mt, embeddablePath, embeddableValue, sp, builder));
}

From source file:org.querybyexample.jpa.ByExampleUtil.java

public <E> Predicate byExampleOnEmbeddable(Path<E> embeddablePath, E embeddableValue, SearchParameters sp,
        CriteriaBuilder builder) {/*w  ww . jav a2s. co m*/
    if (embeddableValue == null) {
        return null;
    }

    Class<E> type = embeddablePath.getModel().getBindableJavaType();
    ManagedType<E> mt = em.getMetamodel().embeddable(type); // note: calling .managedType() does not work

    return JpaUtil.andPredicate(builder, byExample(mt, embeddablePath, embeddableValue, sp, builder));
}