Internal Website Search
1-50 of 200 resultsObtaining a JPA Database Connection In JPA a database connection is represented by the EntityManager interface. Therefore, in order to manipulate an ObjectDB database we need an EntityManager instance. Operations that modify database ... an EntityManager instance consists of two steps. First we need to obtain an instance | |
Working with JPA Entity Objects . In this state the object is not yet associated with an EntityManager and has no representation in ... via an EntityManager’s persist method, which must be invoked within an active transaction. On transaction commit, the owning EntityManager stores the new entity object to the database. More details on storing objects | |
Database Connection using JPA A connection to a database is represented by an EntityManager instance, which also provides ... database connection, using a separate EntityManager instance, for every HTTP request. The main role of an EntityManagerFactory instance is to support instantiation of EntityManager instances | |
Setting and Tuning of JPA Queries on which they were invoked). Flush Mode (setFlushMode) Changes made to a database using an EntityManager em can be visible ... of other EntityManager instances). JPA implementations can easily make uncommitted changes visible in simple JPA ... , either at the EntityManager level as a default for all the queries in that EntityManager or | |
Detached Entity Objects EntityManager but still represent objects in the database. Compared to managed entity objects, detached ... the database unless modified detached objects are merged back into an EntityManager to become managed again. Detached objects are useful in situations in which an EntityManager is not available | |
Shared (L2) Entity Cache Every EntityManager owns a persistence context , which is a collection of all the entity objects ... an entity object that is already managed by the EntityManager returns the existing instance from ... context is one EntityManager . This section describes a level 2 (L2) cache of entity | |
Retrieving JPA Entity Objects. Given an EntityManager em , the following code fragment demonstrates the retrieval of an Employee ... if the specified class is not an entity class. If the EntityManager already manages the specified entity ... method except that if the entity object is not already managed by the EntityManager a hollow object | |
javax.persistence.EntityManager JPA Interface EntityManager Interface used to interact with the persistence context. An EntityManager instance is associated with a persistence context. A persistence context is a set of entity ... . Within the persistence context, the entity instances and their lifecycle are managed. The EntityManager API is used | |
DELETE Queries in JPA/JPQL: Retrieving the entity objects into an EntityManager . Removing these objects from the EntityManager   ... and then removing them, but it should be used cautiously because bypassing the EntityManager may break its synchronization with the database. For example, the EntityManager may not be aware | |
EntityManager.unwrap(cls) - JPA Method JPA Method in javax.persistence. EntityManager T unwrap ( Class cls ) Return ... EntityManager implementation does not support the specified class, the PersistenceException is thrown ... EntityManager implementation class or an interface that it implements. Return: an instance of the specified | |
EntityManager.getDelegate() - JPA Method JPA Method in javax.persistence. EntityManager Object getDelegate () Return the underlying provider object for the EntityManager , if available. The result of this method is implementation specific. The unwrap method is to be preferred for new applications. Return: underlying provider object for EntityManager Since: JPA 1.0 | |
EntityManager.close() - JPA Method JPA Method in javax.persistence. EntityManager void close () Close an application-managed entity manager. After the close method has been invoked, all methods on the EntityManager instance and any Query , TypedQuery , and StoredProcedureQuery objects obtained from it will throw | |
EntityManager.createNamedQuery(name,resultClass) - JPA Method JPA Method in 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 | |
EntityManager.getEntityGraphs(entityClass) - JPA Method JPA Method in javax.persistence. EntityManager List getEntityGraphs ( Class entityClass ) Return all named EntityGraphs that have been defined for the provided class type. Parameters: entityClass - entity class Return: list of all entity graphs defined for the entity Throws: IllegalArgumentException - if the class is not an entity Since: JPA 2.1 | |
EntityManager.merge(entity) - JPA Method JPA Method in javax.persistence. EntityManager T merge ( T entity ) Merge the state of the given entity into the current persistence context. Parameters: entity - entity instance Return: the managed instance that the state was merged to Throws: IllegalArgumentException | |
EntityManager.persist(entity) - JPA Method JPA Method in javax.persistence. EntityManager void persist ( Object entity ) Make an instance managed and persistent. Parameters: entity - entity instance Throws: EntityExistsException - if the entity already exists. (If the entity already exists, the EntityExistsException | |
EntityManager.find(entityClass,primaryKey) - JPA Method JPA Method in javax.persistence. EntityManager T find ( Class entityClass, Object primaryKey ) Find by primary key. Search for an entity of the specified class and primary key. If the entity instance is contained in the persistence context, it is returned | |
EntityManager.remove(entity) - JPA Method JPA Method in javax.persistence. EntityManager void remove ( Object entity ) Remove the entity instance. Parameters: entity - entity instance Throws: IllegalArgumentException - if the instance is not an entity or is a detached entity TransactionRequiredException - if invoked | |
EntityManager.createQuery(criteriaQuery) - JPA Method JPA Method in javax.persistence. EntityManager TypedQuery createQuery ( CriteriaQuery criteriaQuery ) Create an instance of TypedQuery for executing a criteria query. Parameters: criteriaQuery - a criteria query object Return: the new query instance Throws | |
EntityManager.createQuery(qlString) - JPA Method JPA Method in javax.persistence. EntityManager Query createQuery ( String qlString ) Create an instance of Query for executing a Java Persistence query language statement. Parameters: qlString - a Java Persistence query string Return: the new query instance Throws | |
EntityManager.contains(entity) - JPA Method JPA Method in 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 Return: boolean indicating if entity is in persistence context | |
EntityManager.detach(entity) - JPA Method JPA Method in javax.persistence. EntityManager void detach ( Object entity ) Remove the given entity from the persistence context, causing a managed entity to become detached. Unflushed changes made to the entity if any (including removal of the entity), will not be synchronized | |
EntityManager.clear() - JPA Method JPA Method in 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 | |
EntityManager.refresh(entity,lockMode,properties) - JPA Method JPA Method in javax.persistence. EntityManager void refresh ( Object entity, LockModeType lockMode, Map properties ) Refresh the state of the instance from the database, overwriting changes made to the entity, if any, and lock | |
EntityManager.getProperties() - JPA Method JPA Method in javax.persistence. EntityManager Map getProperties () Get the properties and hints and associated values that are in effect for the entity manager. Changing the contents of the map does not change the configuration in effect. Return: map of properties and hints in effect for entity manager Since: JPA 2.0 | |
EntityManager.setProperty(propertyName,value) - JPA Method JPA Method in javax.persistence. EntityManager void setProperty ( String propertyName, Object value ) Set an entity manager property or hint. If a vendor-specific property or hint is not recognized, it is silently ignored. Parameters: propertyName - name | |
EntityManager.getLockMode(entity) - JPA Method JPA Method in javax.persistence. EntityManager LockModeType getLockMode ( Object entity ) Get the current lock mode for the entity instance. Parameters: entity - entity instance Return: lock mode Throws: TransactionRequiredException - if there is no transaction or if the entity | |
EntityManager.lock(entity,lockMode,properties) - JPA Method JPA Method in javax.persistence. EntityManager void lock ( Object entity, LockModeType lockMode, Map properties ) Lock an entity instance that is contained in the persistence context with the specified lock mode type | |
EntityManager.lock(entity,lockMode) - JPA Method JPA Method in javax.persistence. EntityManager void lock ( Object entity, LockModeType lockMode ) Lock an entity instance that is contained in the persistence context with the specified lock mode type. If a pessimistic lock mode type is specified | |
EntityManager.getFlushMode() - JPA Method JPA Method in javax.persistence. EntityManager FlushModeType getFlushMode () Get the flush mode that applies to all objects contained in the persistence context. Return: flushMode Since: JPA 1.0 | |
EntityManager.refresh(entity,lockMode) - JPA Method JPA Method in javax.persistence. EntityManager void refresh ( Object entity, LockModeType lockMode ) Refresh the state of the instance from the database, overwriting changes made to the entity, if any, and lock it with respect to given lock mode type | |
EntityManager.refresh(entity,properties) - JPA Method JPA Method in javax.persistence. EntityManager void refresh ( Object entity, Map properties ) Refresh the state of the instance from the database, using the specified properties, and overwriting changes made to the entity, if any. If a vendor-specific | |
EntityManager.refresh(entity) - JPA Method JPA Method in javax.persistence. EntityManager void refresh ( Object entity ) Refresh the state of the instance from the database, overwriting changes made to the entity, if any. Parameters: entity - entity instance Throws: IllegalArgumentException - if the instance is not | |
EntityManager.find(entityClass,primaryKey,lockMode) - JPA Method JPA Method in javax.persistence. EntityManager T find ( Class entityClass, Object primaryKey, LockModeType lockMode ) Find by primary key and lock. Search for an entity of the specified class and primary key and lock it with respect | |
EntityManager.createQuery(updateQuery) - JPA Method JPA Method in javax.persistence. EntityManager Query createQuery ( CriteriaUpdate updateQuery ) Create an instance of Query for executing a criteria update query. Parameters: updateQuery - a criteria update query object Return: the new query instance Throws | |
EntityManager.createQuery(deleteQuery) - JPA Method JPA Method in javax.persistence. EntityManager Query createQuery ( CriteriaDelete deleteQuery ) Create an instance of Query for executing a criteria delete query. Parameters: deleteQuery - a criteria delete query object Return: the new query instance Throws | |
EntityManager.find(entityClass,primaryKey,properties) - JPA Method JPA Method in javax.persistence. EntityManager T find ( Class entityClass, Object primaryKey, Map properties ) Find by primary key, using the specified properties. Search for an entity of the specified class and primary key | |
EntityManager.setFlushMode(flushMode) - JPA Method JPA Method in javax.persistence. EntityManager void setFlushMode ( FlushModeType flushMode ) Set the flush mode that applies to all objects contained in the persistence context. Parameters: flushMode - flush mode Since: JPA 1.0 | |
EntityManager.flush() - JPA Method JPA Method in javax.persistence. EntityManager void flush () Synchronize the persistence context to the underlying database. Throws: TransactionRequiredException - if there is no transaction or if the entity manager has not been joined to the current transaction PersistenceException - if the flush fails Since: JPA 1.0 | |
EntityManager.getReference(entityClass,primaryKey) - JPA Method JPA Method in javax.persistence. EntityManager T getReference ( Class entityClass, Object primaryKey ) Get an instance, whose state may be lazily fetched. If the requested instance does not exist in the database, the EntityNotFoundException is thrown | |
EntityManager.find(entityClass,primaryKey,lockMode,properties) - JPA Method JPA Method in javax.persistence. EntityManager T find ( Class entityClass, Object primaryKey, LockModeType lockMode, Map properties ) Find by primary key and lock, using the specified properties. Search | |
EntityManager.createEntityGraph(rootType) - JPA Method JPA Method in javax.persistence. EntityManager EntityGraph createEntityGraph ( Class rootType ) Return a mutable EntityGraph that can be used to dynamically create an EntityGraph. Parameters: rootType - class of entity graph Return: entity graph Since: JPA 2.1 | |
EntityManager.getMetamodel() - JPA Method JPA Method in javax.persistence. EntityManager Metamodel getMetamodel () Return an instance of Metamodel interface for access to the metamodel of the persistence unit. Return: Metamodel instance Throws: IllegalStateException - if the entity manager has been closed Since: JPA 2.0 | |
EntityManager.getCriteriaBuilder() - JPA Method JPA Method in javax.persistence. EntityManager CriteriaBuilder getCriteriaBuilder () Return an instance of CriteriaBuilder for the creation of CriteriaQuery objects. Return: CriteriaBuilder instance Throws: IllegalStateException - if the entity manager has been closed Since: JPA 2.0 | |
EntityManager.getEntityManagerFactory() - JPA Method JPA Method in javax.persistence. EntityManager EntityManagerFactory getEntityManagerFactory () Return the entity manager factory for the entity manager. Return: EntityManagerFactory instance Throws: IllegalStateException - if the entity manager has been closed Since: JPA 2.0 | |
EntityManager.getEntityGraph(graphName) - JPA Method JPA Method in javax.persistence. EntityManager EntityGraph getEntityGraph ( String graphName ) Return a named EntityGraph. The returned EntityGraph should be considered immutable. Parameters: graphName - name of an existing entity graph Return: named entity graph Throws | |
EntityManager.createEntityGraph(graphName) - JPA Method JPA Method in javax.persistence. EntityManager EntityGraph createEntityGraph ( String graphName ) Return a mutable copy of the named EntityGraph. If there is no entity graph with the specified name, null is returned. Parameters: graphName - name of an entity graph Return: entity graph Since: JPA 2.1 | |
EntityManager.isJoinedToTransaction() - JPA Method JPA Method in javax.persistence. EntityManager boolean isJoinedToTransaction () Determine whether the entity manager is joined to the current transaction. Returns false if the entity manager is not joined to the current transaction or if no transaction is active Return: boolean Since: JPA 2.1 | |
EntityManager.joinTransaction() - JPA Method JPA Method in javax.persistence. EntityManager void joinTransaction () Indicate to the entity manager that a JTA transaction is active and join the persistence context to it. This method should be called on a JTA application managed entity manager that was created outside the scope of the active | |
EntityManager.getTransaction() - JPA Method JPA Method in javax.persistence. EntityManager EntityTransaction getTransaction () Return the resource-level EntityTransaction object. The EntityTransaction instance may be used serially to begin and commit multiple transactions. Return: EntityTransaction instance Throws: IllegalStateException - if invoked on a JTA entity manager Since: JPA 1.0 |