About EntityManager

forum_thread

Online backup problem

Hi, We are trying to create a servlet that performs database online backup. Unfortunately, even though no exception is thrown, backup files aren't created. When I turn on DEBUG logging in ODB, I get multiple ClassNotFoundExceptions like : ... EntityManagerFactory emf = null ; EntityManager em = null ; String result = "OK" ; ... emf. close ( ) ; } EntityManager is created succesfully, I can query database without any ...

 
manual

SELECT clause (JPQL / Criteria API)

Explains how to use the SELECT clause and projections in a JPA/JPQL query.... returns Country objects that become managed by the EntityManager javax.persistence.EntityManager JPA interface Interface used to interact with the ...

 
api-jpa

createEntityManager()

Create a new application-managed EntityManager.(Method of javax.persistence.EntityManagerFactory)

 
forum_thread

Persist not working when ObjectDB and another db is used in the same application (through spring) with different tx managers

Hi,  Object are not being persisted when ObjectDB and another db is used in the same application (through spring) with different tx managers, please find an example of this below. Any help is greatly appreciate as we are currently evaluating ObjectDB to use in our new enterprise application and we need to decide if we are going to purchase it very soon. Many Thanks   Persistence.xml ... unitName = "testPU" ) private EntityManager em ;   @ PersistenceContext ( unitName = "mysqlPU" ) private EntityManager em1 ;   @ Transactional ( readOnly = ...

 
forum_thread

"Attempt to lock a non entity object" error

Probably a simple answer for someone who's been using ObjectDB for awhile: I'm reading objects from the database outside a transaction (inside doesn't seem to matter). First cycle of doEdit and then doCancelEdit works fine. Second time I doEdit produces the error "Attempt to lock a non entity object" session.rollback() is somehow causing the problem (found through debugging) Is this enough information for someone to suggest what might be happening and how to fix it? ... You need to call  setRetainValues once per EntityManager . ObjectDB Support ObjectDB - ... . Entity ; import javax. persistence . EntityManager ; import javax. persistence . ... TestProject \\ Storage.odb" ) ; EntityManager em = emf. createEntityManager ( ) ; ...

 
manual

Running JPA Queries

Explains how to use JPA to run Java Persistence Query Language (JPQL) queries.... createQuery createQuery(qlString, resultClass) EntityManager's method Create an instance of TypedQuery for executing a ... = em. createQuery createQuery(qlString) EntityManager's method Create an instance of Query for executing a Java ...

 
forum_thread

find() cost unreasonable time!

Hi, I make a full binary tree of 4095 node, I check the first 9 node, but the root cost 24 seconds, why? Result: ... Entry ;   import javax. persistence . EntityManager ; import javax. persistence . EntityTransaction ... testNodes {   private static EntityManager em = SingleManager. getEntityManager ( ) ...

 
forum_thread

Optimistic locking: prevent version increment on entity collection attribute

Hello, I have an entity E with an attribute which is a collection of entities (one to many relationship) with an optimistic locking strategy supported by a version field. Is it possible to prevent the increment of the version of entity E when entities are added to or removed from the collection? Something like the equivalent of @OptimisticLock(excluded=true) in Hibernate? Thanks, Farid ... I am guessing this must be an issue with the EntityManager's life cycle but cannot figure out what. I am using Guice injection and Guice persist and should get one EntityManager per request. Also, please note that in the web app I ...

 
issue

Strange Error with Criteria API and Sorting

We're creating a simple selection (distinct) including an order clause. When watching the created criteria in debugger we get the correct expression: SELECT DISTINCT $1 FROM MyEntity $1 WHERE ((TYPE($1)=class test.MyEntity)) ORDER BY UPPER($1.name) DESC You can see that in the order by there's correctly a "$1" var. Running this (without the type thing before) in the explorer correctly returns the sorted results. However, running this with the criteria API produces this error: ... . Entity ; import javax. persistence . EntityManager ; import javax. persistence . ... ( "objectdb:db/test.tmp;drop" ) ; EntityManager em = emf. createEntityManager ( ) ; ...

 
api-jpa

javax.persistence.NamedQuery

Specifies a static, named query in the Java Persistence query language.(Annotation of JPA)