ObjectDB Database Search

51-100 of 200 results

jakarta.persistence.EntityManager.createNativeQuery(String,String)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager Query createNativeQuery (    String sqlString ,    String resultSetMapping ) Create an instance of Query for executing a native SQL query. Parameters: resultSetMapping - the name of the result set mapping

jakarta.persistence.EntityManager.createQuery(CriteriaDelete)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager Query createQuery (    CriteriaDelete deleteQuery ) Create an instance of Query for executing a criteria delete query. Parameters: deleteQuery - a criteria delete query object Returns: the new query instance. Throws

jakarta.persistence.EntityManager.createQuery(String,Class)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager TypedQuery createQuery (    String qlString ,    Class resultClass ) Create an instance of TypedQuery for executing a Jakarta Persistence query language statement. The select list of the query must contain

jakarta.persistence.EntityManager.createNamedQuery(String)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager Query createNamedQuery (    String name ) Create an instance of Query for executing a named query written in the Jakarta Persistence query language or in native SQL. Parameters: name - the name of a query defined in

jakarta.persistence.EntityManager.createNamedQuery(String,Class)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager TypedQuery createNamedQuery (    String name ,    Class resultClass ) Create an instance of TypedQuery for executing a Jakarta Persistence query language named query. The select list of the query must contain

jakarta.persistence.EntityManager.merge(T)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager T merge (    T entity ) Merge the state of the given new or detached entity instance into the current persistence context, resulting in, respectively, an insert or possible update when the persistence context

jakarta.persistence.EntityManager.remove(Object)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager void remove (    Object entity ) Mark a managed entity instance as removed, resulting in its deletion from the database when the persistence context is synchronized with the database. This operation cascades

jakarta.persistence.EntityManager.find(Class,Object)

Jakarta Persistence (JPA) Method in jakarta.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

jakarta.persistence.EntityManager.find(EntityGraph,Object,FindOption...)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager T find (    EntityGraph entityGraph ,    Object primaryKey ,    FindOption... options ) Find an instance of the root entity of the given EntityGraph by primary key, using the specified options

jakarta.persistence.EntityManager.getReference(Class,Object)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager T getReference (    Class entityClass ,    Object primaryKey ) Obtain a reference to an instance of the given entity class with the given primary key, whose state may be lazily fetched. If the requested

jakarta.persistence.EntityManager.getReference(T)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager T getReference (    T entity ) Obtain a reference to an instance of the entity class of the given object, with the same primary key as the given object, whose state may be lazily fetched. The given object

jakarta.persistence.EntityManager.flush()

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager void flush() Synchronize changes held in the persistence context to the underlying database. Throws: PersistenceException - if the flush fails. TransactionRequiredException - if there is no transaction or if the entity manager

jakarta.persistence.EntityManager.find(Class,Object,Map)

Jakarta Persistence (JPA) Method in jakarta.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

jakarta.persistence.EntityManager.find(Class,Object,LockModeType,Map)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager T find (    Class entityClass ,    Object primaryKey ,    LockModeType lockMode ,    Map properties ) Find by primary key and lock the entity, using the specified properties. Search

jakarta.persistence.EntityManager.find(Class,Object,FindOption...)

Jakarta Persistence (JPA) Method in jakarta.persistence. EntityManager T find (    Class entityClass ,    Object primaryKey ,    FindOption... options ) Find an instance of the given entity class by primary key, using the specified options . Search for an entity

Obtaining a JPA Database Connection

In JPA, a database connection is represented by the EntityManager interface. Therefore, to manipulate an ObjectDB database, you need an EntityManager instance. Operations that modify database ... an EntityManager instance is a two-step process. First, you obtain an EntityManagerFactory instance

Managing JPA Entities

with an EntityManager and has no representation in the database. An entity becomes Managed when it is persisted to the database by using an EntityManager 's persist method, which must be invoked within an active transaction. When the transaction is committed, the owning EntityManager stores the new

JPA Connections and Transactions

A connection to a database is represented by an EntityManager instance, which also provides methods ... connection by using a separate EntityManager instance for each HTTP request. The main role of an EntityManagerFactory instance is to create EntityManager instances. An EntityManagerFactory is constructed

JPA Runtime Tuning & Configuration

): Defaults passed in a property map to the factory builder or defined in persistence.xml . EntityManager (session): Settings applied to an EntityManager instance override global defaults and affect ... defaults for that query. Operation (argument): Settings passed to specific EntityManager operations ( find

Setting and Tuning of JPA Queries

on which they were invoked. Flush mode (setFlushMode) Changes made to a database by using an EntityManager ... . However, these changes are not visible to users of other EntityManager instances. JPA implementations ... . The application can change the default mode at the EntityManager level, which applies to all queries in

JPA Shared (L2) Entity Cache

Every EntityManager has a persistence context , which is a collection of all the entities ... that the EntityManager already manages returns the existing instance from the persistence context, not a newly instantiated one. The persistence context is scoped to a single EntityManager . This section describes

Detached JPA Entities

Detached entities are objects in a special state where they are not managed by an EntityManager ... to the database unless you merge them back into an EntityManager , which makes them managed again. Detached objects are useful when an EntityManager is not available or for transferring objects between different

Retrieving JPA Entities

and its primary key. Given an EntityManager instance em , the following example retrieves an Employee ... class is not an entity class. If the EntityManager already manages the specified entity in ... is similar to the find method, but if the entity is not already managed by the EntityManager

DELETE Queries in JPA/JPQL

: Retrieve the entities into an EntityManager . Remove these objects from the EntityManager ... cautiously because bypassing the EntityManager can disrupt its synchronization with the database. For example, the EntityManager might not be aware that a DELETE query has removed an entity

JPA Container Injection Annotations

the container to inject EntityManager or EntityManagerFactory proxies directly into application components such as services and DAOs. EntityManager injection Inject an EntityManager and configure its scope using the following annotations: Expresses a dependency on a container-managed EntityManager , injecting

UPDATE SET Queries in JPA/JPQL

the entities into an EntityManager . Update the relevant entity fields within an active transaction ... because bypassing the EntityManager can disrupt its synchronization with the database. For example, the EntityManager might not be aware that an UPDATE query has modified a cached entity in

JPA Optimistic and Pessimistic Locking

that another user (using another EntityManager ) has modified the object since the current transaction ... (from another EntityManager instance) currently holds a PESSIMISTIC_WRITE lock on that database object ... fragment: em1. lock (e1, lockMode1); em2. lock (e2, lockMode2); Here, em1 and em2 are two EntityManager

Query Parameters in JPA

a Country object from the database by its name: public Country getCountryByName( EntityManager em ... ( EntityManager em, String name) { TypedQuery query = em. createQuery ( "SELECT c FROM Country c WHERE c.name ... , this time without parameters: public Country getCountryByName( EntityManager em, String name

JPA Exceptions

. This exception often wraps an underlying cause. Thrown when EntityManager .persist is called on an entity ... . This commonly occurs during EntityManager .refresh or EntityManager .getReference calls. Concurrency

jakarta.persistence.EntityManagerFactory

of EntityManager . A persistence unit defines the set of all classes that are related or grouped by ... -managed EntityManager may be created via a call to createEntityManager . However, this approach places ... EntityManager s. Alternatively, in the Jakarta EE environment, a container-managed EntityManager

JPA Lifecycle Events

when the EntityManager detects that an entity has been modified. @PostUpdate : Invoked after an entity ... with the database operation that triggers the event, callback methods must not call EntityManager or Query methods

SELECT clause (JPQL / Criteria API)

The ability to retrieve managed entities is a key advantage of JPQL. For example, the following query returns Country objects, which then become managed by the EntityManager instance em : TypedQuery ... are not associated with an EntityManager , and changes to them during an active transaction are not

Storing JPA Entities

, and its initial state is New. An explicit call to persist associates the object with an owner EntityManager , em ... the EntityManager , or by commit . Referenced embedded objects The following code stores an Employee instance

JPA Queries

EntityManager  methods such as createQuery to build  query objects using: Direct JPQL query strings ... ; EntityManagerFactory or   EntityManager  using the getCriteriaBuilder method. Additional

JPA Query API

with createQuery As with most JPA operations, queries start with an EntityManager (represented as em in the following code snippets). The EntityManager serves as a factory for both Query

JPA Metamodel API

() method or the EntityManager 's getMetamodel() method. Both methods are equivalent. For example, given an EntityManager instance named em , you can get a Metamodel instance as follows: Metamodel

Entity Management Settings

-dirty entities in the persistence context of the EntityManager , which serves as a first-level cache ... the EntityManagerFactory and shared by all its EntityManager instances. To disable the level-2 cache, specify 0 or 0mb

JPA Named Queries Annotations

. Retrieve it by result type from EntityManagerFactory.getNamedQueries , and use it to get a TypedQuery instance via EntityManager .createQuery .

JPA Named Queries

, but you use different EntityManager factory methods to instantiate them. The createNamedQuery method

JPA Core Types

: A heavyweight factory class responsible for creating EntityManager instances. Create

Step 3: Define an EJB Session Bean

java.util.List; import javax.ejb.Stateless; import javax.persistence. EntityManager ; import javax ... { // Injected database connection: @PersistenceContext private EntityManager em; // Stores a new guest ... ). Prepares an  EntityManager automatically and injects it into the  em field

Step 3: Define a Spring DAO Component

; import javax.persistence. EntityManager ; import javax.persistence.PersistenceContext; import javax ... connection: @PersistenceContext private EntityManager em; // Stores a new guest: @Transactional public ... the controller, as shown in the next step. Prepares an  EntityManager automatically and injects it into

Step 3: Define a Spring DAO Component

.List; import javax.persistence. EntityManager ; import javax.persistence.PersistenceContext; import ... connection: @PersistenceContext private EntityManager em; // Stores a new guest: @Transactional public ... the controller, as shown in the next step. Prepares an  EntityManager automatically and injects it into

Step 3: Define an EJB Session Bean

. EntityManager ; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery ... EntityManager em; // Stores a new guest: public void persist(Guest guest) { em.persist(guest ... the next step ). Prepares an EntityManager automatically and injects it into the em field

Step 4: Add a Servlet Class

)getServletContext().getAttribute("emf"); EntityManager em = emf.createEntityManager(); try { // Handle ... is retrieved from the application scope attribute, and then an EntityManager (representing a database

Step 4: Add a Servlet Class

: EntityManagerFactory emf = (EntityManagerFactory)getServletContext().getAttribute("emf"); EntityManager em ... , and then an EntityManager (representing a database connection) is constructed. If a new guest has registered

Step 6: Set the Spring XML

and transactions), to inject a JPA  EntityManager , to manage transactions and to look for JSP pages in

Step 6: Set the Spring XML

, controllers and transactions), to inject a JPA EntityManager , to manage transactions and to look

Step 3: Add a Main Class

;          "$objectdb/db/p2.odb"); EntityManager em

Step 3: Add a Main Class

;        "$objectdb/db/p2.odb"); EntityManager em = emf