ObjectDB Database Search

51-100 of 200 results

EntityManager refresh problem

Hi, in the following code you can see an example with EntityManager .refresh(). The example ... -------------------- package example; import java.io.File; import javax.persistence. EntityManager ; import ... ;  public void refreshTest() {         EntityManager

UserException - Object User#2 belongs to another EntityManager

EntityManager with the same unitName. TradesC method needs an User, which is taken from UserDataB ... .pingushare.entity.p1.User#2' belongs to another EntityManager at com.objectdb.o.MSG.d(MSG.java:61 ... this should be a problem if, in the same transaction, an entity is passed into more EntityManagers , but here are 2

Pooling of EntityManagers

an internal pool of connections, and when an EntityManager is closed the underlying socket to the server is returned to the pool and can be reused with another new  EntityManager , as ... ; EntityManager holds is not preserved or reused. Is may be worth reusing these caches as well in some

EntityManager JPA or JDO impl and different behavior

Hi, I have an issue with the EntityManager . My persistance XML looks like: com.objectdb.jpa.Provider Now in our project we use spring to start everything. If I do: System.out.println(" EntityManager ... , I get: com.objectdb.jdo.PMImpl Whats going on here? Is the entityManager not controlled by

Attempt to execute a query using a closed EntityManager

. com.objectdb.o.UserException - Attempt to execute a query using a closed EntityManager at com ... to execute a query using a closed EntityManager at org.apache.myfaces.view.facelets.el ... .o._PersistenceException: Attempt to execute a query using a closed EntityManager at org.apache.el

Object belongs to another EntityManager - ERROR

' belongs to another EntityManager (error 613) 10:29:14,887 ERROR [stderr] (http--10.23.3.98-8081-5 ... to another EntityManager 10:29:15,072 ERROR [stderr] (http--10.23.3.98-8081-5) at com.objectdb.o ... 'pbdmodel.impl.OrgJedinicaImpl#8' belongs to another EntityManager 10:29:15,089 ERROR [stderr] (http--10.23

EntityManagerFactory objects being locked during EntityManager creation

wherein the EntityManagerFactory objects are being locked during EntityManager object creation.  Please refer ... with ObjectDB wherein the EntityManagerFactory objects are being locked during EntityManager object creation.  This is the normal behavior of ObjectDB. Creation operations of  EntityManager

EntityManager.find(entityClass, primaryKey) is slow when accessing non-existent IDs

. EntityManager ; import javax.persistence.TypedQuery; /** * @author Stanislav Jakuschev 28.02.2023 * * EntityManager .find(entityClass, primaryKey) is slow when accessing * non-existent IDs. * * Select queries ... "XId [a=" + a + ", b=" + b + ", c=" + c + "]"; } } public static void clear( EntityManager em) { Instant

Suspected memleak caused by bad state of EntityManager

Our application manages the Entities itself, so we close the EntityManager after every creating ... and finalize, we found the problem is caused by bad state of EntityManager . After first throwing the InternalException, the EntityManager throws every time when doing merge operation, but it can be closed

Issue with orphanRemoval and multiple EntityManagers

with orphanRemoval set to true. I use a new EntityManager for each transaction (which normally happens in ... entity, the database contains 3 child entities. If I use the same EntityManager for both transactions ... ;      EntityManager em = emf.createEntityManager();     

creating EntityManager on odb file created on Mac 64bit on Windows 32bit

an EntityManagerFactory and later  EntityManager on this file, every thing is working fine ... EntityManager . Do you have any idea why does it crash? Thanks, Marcin  marcins Marcin ObjectDB uses ... .  But still the code crashes while creating  EntityManager on this odb file. And the program

Metamodel Attribute NOT EQUALS to same Attribute in a different EntityManager

from Metamodel of a differente EntityManager initialized on a @Controller @RequestMapping event. I ... is it: If I have two moments of initialization of "javax.persistence.metamodel" from EntityManager and these two metamodels come from different EntityManagers . One of these is on a @PostConstruct event

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

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

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

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

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

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

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

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

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

ObjectDB Object Database Features

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

Updating JPA Entity Objects

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

JPA Query API

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

JPA Queries

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

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

JPA Named Queries

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

Online Backup

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

JPA Criteria API Queries

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

Posting Sample Code

; EntityManager em = emf.createEntityManager();         em

An entityManager.flush() with many entities is not possible

  The following exception occures if we call entityManager .flush() where the corresponding JPA PersistenceContext has many entities and relations. What is the reason for the exception? entityManager .getTransaction().commit() instead of a entityManager .flush() works correctly. Unfortunately I

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 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 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 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 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 3: Add a Main Class

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

Step 3: Add a Main Class

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

Step 6: Set the Spring XML

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

Step 6: Set the Spring XML

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