ObjectDB Database Search

1-50 of 165 results

jakarta.persistence.EntityManager

Jakarta Persistence (JPA) Interface jakarta.persistence. EntityManager Super Interfaces: AutoCloseable Interface used to interact with the persistence context. An instance of EntityManager ... to the associated persistence unit. An application-managed EntityManager may be created

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

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 getMetamodel() causes crash

I am trying to track down some obscure errors with multi-threading.  This involved looking at the EntityManager Metamodel but this caused an ObjectDB exception.  So I reverted ... ;password=admin;drop" EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); MyEntity

EntityManager creation taking long time

In our production environment, entity manager creation, the line below, sometimes take upto few ten's of seconds to create. Is there any reason that is known which may be causing this ? Any suggestions on how this can be addressed ?   EntityManager entityManager = factory.createEntityManager

javax.persistence.PersistenceException: No Persistence provider for EntityManager named in Karaf 4.0.7 and OSGi DS test

.persistence.PersistenceException: No Persistence provider for EntityManager named objectdb

EntityManager.merge gives EntityNotFoundException

Just started using objectdb (2.3.4). Calling EntityManager .merge for a new (non-managed) object gives EntityNotFoundException. I am perplexed by this. See attached test case. Thanks for your assistance. Full error output is: Exception in thread "main" [ObjectDB 2.3.4] javax.persistence

Executing JUnit "all tests" throws "Object ... belongs to another EntityManager" Exception

.Symbol#7' belongs to another EntityManager [Symbol:7] When I change the order in which the test runs (by

Setting and Tuning of JPA Queries

on which they were invoked. Flush mode (setFlushMode) Changes made to a database by using an EntityManager ... . However, these changes are not visible to users of other EntityManager instances. JPA implementations ... . The application can change the default mode at the EntityManager level, which applies to all queries in

Detached JPA Entities

Detached entities are objects in a special state where they are not managed by an EntityManager ... to the database unless you merge them back into an EntityManager , which makes them managed again. Detached objects are useful when an EntityManager is not available or for transferring objects between different

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

JPA Lifecycle Events

when the EntityManager detects that an entity has been modified. @PostUpdate : Invoked after an entity ... with the database operation that triggers the event, callback methods must not call EntityManager or Query methods

SELECT clause (JPQL / Criteria API)

The ability to retrieve managed entities is a key advantage of JPQL. For example, the following query returns Country objects, which then become managed by the EntityManager instance em : TypedQuery ... are not associated with an EntityManager , and changes to them during an active transaction are not

Storing JPA Entities

, and its initial state is New. An explicit call to persist associates the object with an owner EntityManager , em ... the EntityManager , or by commit . Referenced embedded objects The following code stores an Employee instance

JPA Named Queries Annotations

. Retrieve it by result type from EntityManagerFactory.getNamedQueries , and use it to get a TypedQuery instance via EntityManager .createQuery .

jakarta.persistence.EntityNotFoundException

by the persistence provider when an entity reference obtained by EntityManager .getReference is accessed but the entity does not exist. Thrown when EntityManager .refresh is called and the object no longer exists in the database. Thrown when EntityManager .lock is used with pessimistic locking is used

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

We 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

jakarta.persistence.EntityGraph

. See Also: AttributeNode Subgraph NamedEntityGraph EntityManager .createEntityGraph(Class) EntityManager .createEntityGraph(String) EntityManager .getEntityGraph(String) EntityManagerFactory.addNamedEntityGraph(String, EntityGraph) EntityManager .find(EntityGraph, Object, FindOption...) Since: Jakarta

Merge with Parent/Child entities not possible

.persistence.Entity; import javax.persistence. EntityManager ; import javax.persistence.EntityManagerFactory ... void setId(long id) {    this.id = id;   } } private EntityManager ... ; EntityManager entityManager = emf.createEntityManager();   entityManager .setFlushMode(FlushModeType.AUTO

jakarta.persistence.NamedEntityGraph

. A reference to a named entity graph may be obtained by calling EntityManager .getEntityGraph , and may be passed to EntityManager .find . Since: Jakarta Persistence (JPA) 2.1 Annotation Elements String name (Optional) The name used to identify the entity graph in calls to EntityManager .getEntityGraph

jakarta.persistence.FindOption

Jakarta Persistence (JPA) Interface jakarta.persistence.FindOption An option influencing the behavior of EntityManager .find . Built-in options control locking , cache interaction , and timeouts ... Timeout EntityManager .find(Class, Object, FindOption...) EntityManager .find(EntityGraph, Object, FindOption...) Since: Jakarta Persistence (JPA) 3.2

Memory Leaks after COMMIT operation (checked on versions 2.6.5 & 2.6.6.b01)

_ EntityManager = m_EntityMgrFactory.createEntityManager(); m_ EntityManager .setFlushMode( FlushModeType.COMMIT ); if ( m_ EntityManager .isOpen() ) { m_ EntityManager .getTransaction().begin(); for ( Pa3DataKey dataKey : aDataKeys ) { m_ EntityManager .persist( dataKey ); } m_ EntityManager .getTransaction().commit

jakarta.persistence.FlushModeType

Enumerates flush modes recognized by the EntityManager . When queries are executed ... transaction, the persistence provider must not flush to the database. See Also: EntityManager

jakarta.persistence.LockOption

Jakarta Persistence (JPA) Interface jakarta.persistence.LockOption An option influencing the behavior of EntityManager .lock . Built-in options control scope , and timeouts . This interface ... . See Also: LockModeType PessimisticLockScope Timeout EntityManager .lock(Object, LockModeType, LockOption...) Since: Jakarta Persistence (JPA) 3.2

jakarta.persistence.EntityExistsException

the persistence provider when EntityManager .persist is called and the entity already exists ... . See Also: EntityManager .persist(Object) Since: Jakarta Persistence (JPA) 1.0 Public Constructors

Optimistic locking: prevent version increment on entity collection attribute

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 actually ... ;  } } public void test() {     // em is the EntityManager     em

Missing (null) elements in eager loaded references

(all of them)? Does it happen when the EntityManager is open or closed? Note that if you are working with detached objects (e.g. after closing the EntityManager ) then anything that has not ... yet resolved before the elements are returned and the EntityManager is closed? Kevin Kevin Pfaff So you say

Memory Leak in EntityManagerFactory ?

(db_name) 3. After runnings some automatic tests for ca. 1 h all EntityManagers are closed ... the Database but more the 236 Copies of those entitities in the memory (after closing all EntityManagers ... an EntityManager  in the connection pool of a live E ntityManagerFactory , where that EntityManager

Internal exception when updating date filed (TemporalType.DATE)

entityManagerFactory;         private EntityManager entityManager ... ;  entityManager = entityManagerFactory.createEntityManager();        ... ;    entityManager .getTransaction().begin();        

jakarta.persistence.PersistenceUnitTransactionType

Jakarta Persistence. An EntityManager may be a JTA entity manager, where transaction management

jakarta.persistence.LockModeType

as an argument to: one of the methods of EntityManager which obtains locks ( lock() , find() , or

jakarta.persistence.ConnectionConsumer

EntityManager .runWithConnection(ConnectionConsumer) Since: Jakarta Persistence (JPA) 3.2 Public Instance

jakarta.persistence.ConnectionFunction

EntityManager .callWithConnection(ConnectionFunction) Since: Jakarta Persistence (JPA) 3.2 Public

jakarta.persistence.EntityTransaction

Jakarta Persistence (JPA) Interface jakarta.persistence.EntityTransaction Interface used to control transactions on resource-local entity managers. The EntityManager .getTransaction method returns the EntityTransaction interface. Since: Jakarta Persistence (JPA) 1.0 The Database Connection using

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

Problem on JPA Merge Entity.

Hello, I have a problem with the EntityManager .merge() function. I set a property value ... ErgoDaoJpa implements IErgoDao { @PersistenceContext private EntityManager entityManager ; public void ... ; throws EntryAlreadyExistException, DaoException { entityManager .persist(ergoClass); } public void

Filename.odb$ Persisting Issue

; static EntityManager departmentDB = emf.createEntityManager(); public  static EntityManager employeeDB = emf.createEntityManager(); public  static EntityManager paygradeDB = emf.createEntityManager(); public  static EntityManager programDB = emf.createEntityManager(); public  static

Mismatch client-server protocol prefix

EntityManager ) by two concurrent threads. ObjectDB synchronizes use of EntityManager by different threads ... implementation. Maybe a socket from a closed EntityManager is still used after the EntityManager is closed after its resources are allocated and used by a new EntityManager . You may try the following

openejb jpa jaas module

.persistence. EntityManager ; import javax.persistence.EntityManagerFactory; import javax.persistence ... entityManagerFactory; private EntityManager entityManager ; protected Map sharedState = new HashMap (); private ... = Persistence.createEntityManagerFactory((String) options.get("url")); entityManager

Duplicate Entity class names causes Exception in Query

class Singleton implements Serializable { public static Singleton getInstance( EntityManager em ... int version; @Basic protected java.lang.Integer lastInstance; public void generateItems( EntityManager ... (this, startCnt); em.persist(item); lastInstance = startCnt; } } public Item findItem( EntityManager em, int

Database is erased after deploying a new web application version

? When should I use the close method of EntityManagerFactory and  EntityManager ? As long as ... the close method of EntityManagerFactory and  EntityManager ? You can close the  EntityManagerFactory when the web application is closed (see this example ). Usually  EntityManager

jakarta.persistence.PersistenceContext.synchronization

to the current transaction by means of the EntityManager .joinTransaction method. Default

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

Remove of an entry from a @OneToMany collection is not possible if the enhancer is disabled

. EntityManager ; import javax.persistence.EntityManagerFactory; import javax.persistence.FetchType; import ... ; EntityManager entityManager = emf.createEntityManager();   ParentEntity parentEntity = new ParentEntity();   entityManager .getTransaction().begin();   entityManager .persist(parentEntity

[ObjectDB 2.2.6_02] Unexpected exception (Error 990) at com.objectdb.o.OBC.aJ(OBC.java:961)

.persistence. EntityManager ; import javax.persistence.EntityManagerFactory; import javax.persistence ... () { emf = Persistence.createEntityManagerFactory("ReproducePU"); }   public EntityManager ... findMomentEntity(Long id) { EntityManager em = getEntityManager(); try { return em.find(MomentEntity.class, id

After using the enhancer, Lazy loaded collections are no longer loading. They are set as null

; } } /** Workflow **/ Account account = new Account(); entityManager .persist(account); entityManager .flush(); Project project = new Project(); project.setAccount(account); entityManager .persist(project); entityManager .flush(); account = entityManager .find(account); assertNonNull(account.getProjects

JQL-Update Queries fails with activated L2-Cache

When using JQL-Update Queries it is basically not working without calling entityManager .clear() after a transaction commit. When the clear() method isn't called the entityManager will never return ... cautiously because bypassing the EntityManager may break its synchronization with the database. For example