About managed

forum_thread

On ensuring ID available after persist

This reports on a possible solution to a common problem: I was trialling ObjectDB on an existing, functioning, large JavaEE/JPA web application, which until now had used EclipseLink+MySQL and then Oracle+MySQL. On trying it out on ObjectDB I hit a problem with my very extensive entity wiring code, which relies on an "external" entity object having a non-null id after it has been passed to EntityManager.persist, thus: ... merely state that it should "Make an instance managed and persistent.", and unlike merge() there is no managed entity returned. My copious entity wiring code assumed that the Java ... becomes endowed with an id (the same as the "internal" managed entity), which under EclipseLink it did. Performing em.flush() ...

 
api-jpa

javax.persistence.PersistenceUnit

Expresses a dependency on an EntityManagerFactory and its associated persistence unit.(Annotation of JPA)

 
release

2.3.3

... execution. Fixed a bug in using non managed non enhanced entity objects as parameters or in criteria queries ( ... Fixed an "Attempt to persist a reference to a non managed instance" bug. Fixed internal  ...

 
release

2.2.7

... Fixed an "Attempt to persist a reference to a non managed instance" bug. Fixed internal  ...

 
forum_thread

Extra uninitialised entities spawned on merge()

In the following, Element is a base entity class, with a bi-directional @ManyToOne-@OneToMany relationship Element owner - List<Element> ownedElements, and Example is a subclass entity with a relationship @OneToOne Element child. ... the merge() operation will attempt to update the managed entity to point to managed versions of the entities referenced by the detached entity. If the ...

 
api-jdo

javax.jdo.spi.StateInterrogation

This interface is implemented by a non-binary-compatible JDO implementation to provide state interrogation for non-enhanced persistent classes.(Interface of JDO)

 
forum_thread

Entity Update - Is the documentation up to date?

I'm working on my first ObjectDB project, and I just went back and reviewed some of the documentation.  Turns out I've been doing two things that http://www.objectdb.com/java/jpa/persistence/update suggests should not work. First, I've been modifying managed entities from outside an active transaction.  If I subsequently begin and commit a transaction, all my changes seem to be merged automatically. ... should not work. First, I've been modifying managed entities from outside an active transaction.  If I ... version. > First, I've been modifying managed entities from outside an active transaction.  If I subsequently ...

 
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: ... JPA implementations have to detect modifications to managed objects automatically in order to apply changes to the database on ... This could be done by keeping a copy of every managed object and comparing copies to actual objects on every flush or ...

 
release

2.2.8

... Fixed an "Attempt to persist a reference to a non managed instance" bug. Fixed internal  ...

 
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? ... clear the entire persistence context and detach all managed entity objects: ... Rolling back a transaction - either by ... on rollback with JPA. To keep the entity objects managed with their current changes: PersistenceManager pm ...