Internal Website 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

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

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

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

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

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();     

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

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

EntityManager to closed

Hi I understand we should close the entitymanager after each use, and close the factory ... server mode.  I am just running some test cases and opened up 100 entitymanager via factory ... , at least for a while). The issue with not closing EntityManager and  EntityManagerFactory instances

EntityManager.isOpen() - JPA Method

JPA Method in javax.persistence. EntityManager boolean isOpen () Determine whether the entity manager is open. Return: true until the entity manager has been closed Since: JPA 1.0

EntityManager.createStoredProcedureQuery(procedureName) - JPA Method

JPA Method in javax.persistence. EntityManager StoredProcedureQuery createStoredProcedureQuery (   String procedureName ) Create an instance of StoredProcedureQuery for executing a stored procedure in the database. Parameters must be registered before the stored procedure

EntityManager.createNamedStoredProcedureQuery(name) - JPA Method

JPA Method in javax.persistence. EntityManager StoredProcedureQuery createNamedStoredProcedureQuery (   String name ) Create an instance of StoredProcedureQuery for executing a stored procedure in the database. Parameters must be registered before the stored procedure can be executed

EntityManager.createNativeQuery(sqlString,resultSetMapping) - JPA Method

JPA Method in 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

EntityManager.createStoredProcedureQuery(procedureName,resultSetMappings) - JPA Method

JPA Method in javax.persistence. EntityManager StoredProcedureQuery createStoredProcedureQuery (   String procedureName,    String... resultSetMappings ) Create an instance of StoredProcedureQuery for executing a stored procedure in the database. Parameters

EntityManager.createStoredProcedureQuery(procedureName,resultClasses) - JPA Method

JPA Method in javax.persistence. EntityManager StoredProcedureQuery createStoredProcedureQuery (   String procedureName,    Class... resultClasses ) Create an instance of StoredProcedureQuery for executing a stored procedure in the database. Parameters

EntityManager.createNamedQuery(name) - JPA Method

JPA Method in 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 Return: the new query

EntityManager.createQuery(qlString,resultClass) - JPA Method

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

EntityManager.createNativeQuery(sqlString,resultClass) - JPA Method

JPA Method in 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

EntityManager.createNativeQuery(sqlString) - JPA Method

JPA Method in javax.persistence. EntityManager Query createNativeQuery (   String sqlString ) Create an instance of Query for executing a native SQL statement, e.g., for update or delete. If the query is not an update or delete query, query execution will result in each row

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

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

JPA Criteria API Queries

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

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