Example usage for org.springframework.data.jpa.repository.support JpaMetamodelEntityInformation JpaMetamodelEntityInformation

List of usage examples for org.springframework.data.jpa.repository.support JpaMetamodelEntityInformation JpaMetamodelEntityInformation

Introduction

In this page you can find the example usage for org.springframework.data.jpa.repository.support JpaMetamodelEntityInformation JpaMetamodelEntityInformation.

Prototype

public JpaMetamodelEntityInformation(Class<T> domainClass, Metamodel metamodel) 

Source Link

Document

Creates a new JpaMetamodelEntityInformation for the given domain class and Metamodel .

Usage

From source file:example.springdata.jpa.compositions.FlushOnSaveRepositoryImpl.java

@SuppressWarnings({ "unchecked", "rawtypes" })
private <S extends T> EntityInformation<Object, S> getEntityInformation(S entity) {

    Class<?> userClass = ClassUtils.getUserClass(entity.getClass());

    if (entity instanceof AbstractPersistable<?>) {
        return new JpaPersistableEntityInformation(userClass, entityManager.getMetamodel());
    }/*from w w w  .  j  a  v  a 2s  .  c  o  m*/

    return new JpaMetamodelEntityInformation(userClass, entityManager.getMetamodel());
}