Home » Search

About EntityManager

11-20 of 200Refresh
Tutorial
45

Step 3: Define a Spring DAO Component

.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence ... : @PersistenceContext private EntityManager em; // Stores a new guest: @Transactional ... the next step. Prepares an EntityManager automatically and injects it into the em field
Manual
45

Storing JPA Entity Objects

state is New. An explicit call to persist associates the object with an owner EntityManager em ... managed by the EntityManager) or by commit. Referenced Embedded Objects The following code stores ... to the database using flush are considered temporary and are only visible to the owner EntityManager
JPA Doc
45

clear()

Method javax.persistence.EntityManager void clear() Clear the persistence context, causing all managed entities to become detached. Changes made to entities that have not been flushed to the database will not be persisted. Since: JPA 1.0
JPA Doc
45

contains(entity)

Method javax.persistence.EntityManager boolean contains(   Object entity ) Check if the instance is a managed entity instance belonging to the current persistence context. Parameters: entity - entity instance Returns: boolean indicating if entity is in persistence context Throws: IllegalArgumentException - if not an entity Since: JPA 1.0
JPA Doc
45

createNamedQuery(name)

Method javax.persistence.EntityManager Query createNamedQuery(   String name ) Create an instance of Query for executing a named query (in the Java Persistence query language or in native SQL). Parameters: name - the name of a query defined in metadata Returns: the new query instance Throws
JPA Doc
45

createNamedQuery(name, resultClass)

Method javax.persistence.EntityManager TypedQuery createNamedQuery(   String name,   Class resultClass ) Create an instance of TypedQuery for executing a Java Persistence query language named query. The select list of the query must contain only a single item, which must be assignable
JPA Doc
45

createNativeQuery(sqlString)

Method javax.persistence.EntityManager Query createNativeQuery(   String sqlString ) Create an instance of Query for executing a native SQL statement, e.g., for update or delete. Parameters: sqlString - a native SQL query string Returns: the new query instance Since: JPA 1.0
JPA Doc
45

createNativeQuery(sqlString, resultClass)

Method javax.persistence.EntityManager Query createNativeQuery(   String sqlString,   Class resultClass ) Create an instance of Query for executing a native SQL query. Parameters: sqlString - a native SQL query string resultClass - the class of the resulting instance(s) Returns: the new query instance Since: JPA 1.0
JPA Doc
45

createNativeQuery(sqlString, resultSetMapping)

Method javax.persistence.EntityManager Query createNativeQuery(   String sqlString,   String resultSetMapping ) Create an instance of Query for executing a native SQL query. Parameters: sqlString - a native SQL query string resultSetMapping - the name of the result set mapping Returns: the new query instance Since: JPA 1.0
JPA Doc
45

createQuery(criteriaQuery)

Method javax.persistence.EntityManager TypedQuery createQuery(   CriteriaQuery criteriaQuery ) Create an instance of TypedQuery for executing a criteria query. Parameters: criteriaQuery - a criteria query object Returns: the new query instance Throws: IllegalArgumentException - if the criteria query is found to be invalid Since: JPA 2.0