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, 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

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

UPDATE SET Queries in JPA/JPQL

the entity objects into an EntityManager . Updating the relevant entity object fields  ... and then updating 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

Locking in JPA

(using another EntityManager ) since it was retrieved by the current updater. Optimistic locking ... another EntityManager instance) currently holds a PESSIMISTIC_WRITE lock on that database object ... . lock (e1, lockMode1); em2. lock (e2, lockMode2); em1 and em2 are two EntityManager instances

JPA Lifecycle Events

is invoked: @PrePersist - before a new entity is persisted (added to the EntityManager ... the EntityManager . @PostUpdate - after updating an entity in the database (during commit or flush ). @PreRemove - when an entity is marked for removal in the EntityManager . @PostRemove

Query Parameters in JPA

getCountryByName( EntityManager em, String name) { TypedQuery query = em. createQuery ( "SELECT c FROM ... ( EntityManager em, String name) { TypedQuery query = em. createQuery ( "SELECT c FROM Country c ... ( EntityManager em, String name) { TypedQuery query = em. createQuery ( "SELECT c FROM Country c

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

SELECT clause (JPQL / Criteria API)

The ability to retrieve managed entity objects is a major advantage of JPQL. For example, the following query returns Country objects that become managed by the EntityManager em : TypedQuery query ... that are retrieved directly by a result path expression are not associated with an EntityManager and changes

Storing JPA Entity Objects

is New. An explicit call to persist associates the object with an owner EntityManager em and changes ... managed by the EntityManager ) or by commit . Referenced Embedded Objects The following code stores

JPA Metamodel API

method or by the EntityManager 's getMetamodel method (both methods are equivalent). For example, given an EntityManager , em , a Metamodel instance can be obtained by: Metamodel metamodel = em

Entity Management Settings

the reference type for holding non dirty entities in the persistence context of the EntityManager ... that is managed by the EntityManagerFactory and shared by all its EntityManager instances. The level 2 cache

JPA Queries

the EntityManagerFactory 's getCriteriaBuilder method or by the  EntityManager 's

JPA Named Queries

but different EntityManager factory methods are used to instantiate them. The createNamedQuery method

JPA Query API

with an EntityManager (represented by em in the following code snippets), which serves as a factory

CRUD Database Operations with JPA

Given an EntityManager , em , that represents a JPA connection to the object database, we can use it to store, retrieve, update and delete database objects. Storing New Entity Objects The following code fragment stores 1,000 Point  objects in the database: em. getTransaction (). begin

Posting Sample Code

; EntityManager em = emf.createEntityManager();         em

Online Backup

. Starting Online Backup The online backup can be started by executing a special query on an EntityManager

Updating JPA Entity Objects

entity object from within an active transaction. No EntityManager 's method is invoked to report

ObjectDB Object Database Features

(per EntityManager ). L2 shared entity data cache  (per EntityManagerFactory). Database file page cache

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 ... ; next step ). 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

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

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