Example usage for javax.persistence.metamodel Type getJavaType

List of usage examples for javax.persistence.metamodel Type getJavaType

Introduction

In this page you can find the example usage for javax.persistence.metamodel Type getJavaType.

Prototype

Class<X> getJavaType();

Source Link

Document

Return the represented Java type.

Usage

From source file:org.jdal.dao.jpa.JpaDao.java

/**
 * @param class1//from   w  w  w  .jav a 2s . co  m
 * @return
 */
private <K> SingularAttribute<? super K, ?> getIdAttribute(Class<K> clazz) {
    Type<?> type = em.getMetamodel().entity(clazz).getIdType();
    EntityType<K> entity = em.getMetamodel().entity(clazz);
    SingularAttribute<? super K, ?> id = entity.getId(type.getJavaType());
    return id;
}