Example usage for javax.persistence EntityManager contains

List of usage examples for javax.persistence EntityManager contains

Introduction

In this page you can find the example usage for javax.persistence EntityManager contains.

Prototype

public boolean contains(Object entity);

Source Link

Document

Check if the instance is a managed entity instance belonging to the current persistence context.

Usage

From source file:io.apiman.manager.api.jpa.JpaStorage.java

private <T> void remove(T entity) throws StorageException {
    EntityManager em = getActiveEntityManager();
    em.remove(em.contains(entity) ? entity : em.merge(entity));
}