About EntityManager

manual

Database Connection using JPA

Describes the main JPA interfaces: EntityManagerFactory, EntityManager and EntityTransaction.... Overview EntityManagerFactory EntityManager EntityTransaction Overview A connection to a database is represented by an EntityManager javax.persistence.EntityManager JPA interface ...

 
manual

Obtaining a JPA Database Connection

Shows how to use Java/JPA to connect to the ObjectDB Object Database. In JPA a database connection is represented by the EntityManager javax.persistence.EntityManager JPA interface Interface used to interact with the ...

 
manual

Storing JPA Entity Objects

Explains how to use JPA to store (persist) entity objects in the database.... invoking the persist persist(entity) EntityManager's method Make an instance managed and persistent. See ... ; em. getTransaction getTransaction() EntityManager's method Return the resource-level EntityTransaction object. ...

 
manual

Detached Entity Objects

Explains detached entity objects and how to work with detached objects in JPA, including merging them into an EntityManager.... special state in which they are not managed by any EntityManager javax.persistence.EntityManager JPA interface Interface used to interact with the ...

 
forum_thread

EntityManager refresh problem

Dear Support, in the following code you can see a EntityManager.refresh() example. The example throws an assertion error with the following statement: Assert.assertEquals("entity 1", simpleEntity1.getFieldA()); In my opinion there should be no assertion error. I have tested the example with several objectdb versions (2.5.4, 2.5.6_06 and 2.5.7). Do you have an explanation for the assertion error? ... in the following code you can see an example with EntityManager.refresh(). The example throws an assertion error (The Assert ... . File ;   import javax. persistence . EntityManager ; import javax. persistence . ...

 
forum_thread

Performance in large transactions

Hello, we have a performance problem when we use a large transaction. Let's do exactly the same in several transactions the ObjectDB works much faster. In our use case, we create many new entities and between the creations we call a select query. The execution of the query becomes slower at each iteration. (In the query, we search for an item of type Entity2. However, there is only one entity.)   Pseudocode for the fast and the slow solution FAST: ... ; i <100 ; i ++ ) { EntityManager entityManager = getEntityManagerFactory ( ) . ...

 
forum_thread

Is it possible to remove parent/child entities without refresh?

We have a big object tree in our project. If I use the entityManage.remove method a entityManager.refresh is necessary in order to have an updated object tree in memory. But entityManager.refresh is too slow for our project. Do you know a possibilty to remove parent/child entities without entityManager.refresh after the entityManager.remove operation? I have searched for a solution with the following unit test (See testRemoveVariant2()). But my approach works correctly. Do you have an idea? ... have a big entity object tree in our project. If I use the entityManager.remove(childEntity) method to remove a child entity a entityManager.refresh(parentEntity) is necessary in order to have an updated parent/child object tree in memory. But entityManager.refresh is too slow for our project. Do you know a way to remove ...

 
manual

CRUD Operations with JPA

Explains how to use JPA for CRUD database operations (persist, retrieve, update, remove). The following subsections explain how to use JPA for CRUD database operations: Storing JPA Entity Objects Retrieving JPA Entity Objects Updating JPA Entity Objects Deleting JPA Entity Objects ...

 
forum_thread

Merge with Parent/Child entities not possible

Can you please tell me why the following unit test ends with "[ObjectDB 2.5.7_02] javax.persistence.RollbackException"? ... . Entity ; import javax. persistence . EntityManager ; import javax. persistence . ... = id ; } }   private EntityManager createEntityManager ( String dbFileName, boolean ...

 
manual

Retrieving JPA Entity Objects

Explains how to use JPA to retrieve entity objects from the database.... combination of its class and its primary key. Given an EntityManager javax.persistence.EntityManager JPA interface Interface used to interact with the ...