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

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

Introduction

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

Prototype

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

Source Link

Document

Creates a new JpaPersistableEntityInformation 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  . ja  va2  s .c  o  m

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