ObjectDB ObjectDB

Is it possible to commit only specific elements?

#1

Hello,

As stated above, I would like to know if it is possible to commit only specific elements, or at least update a single table, disregarding the other entities loaded in the persistency context?

I have a complex hierarchy of intertwined objects. Currently I am clearing my persistency context, retrieving only the needed ones, creating new ones (which I want to commit), detaching the ones I've previously retrieved and finally committing.

My context is big data and performance is an issue. 

 

 

edit
delete
#2

If you split the activity to several transactions you can commit some of them and rollback others. Since JPA supports one transaction per thread, you will have to split the activity to multiple threads.

Another option is to detach specific objects from the persistence context (which you want to discard their update) before commit.

 

ObjectDB Support
edit
delete
#3

Thank you for your reply, I have solved the issue via cleaning the persistency context and retrieving/creating only the required entries. 

I would have a subsequent question: now in the retrieval of my entities from the database, I am working in a lazy loading context, I get an OutOfMemory Exception, particularly when I attempt to access a HashMap that is comprised of objects as keys and lists of objects as values. The map in itself does not have a problematic amount of entries but the lists contained as values hold big data (currently holding 100 000 instances). 

Is there a posibility of accessing particular instances in the aforementioned lists (stored in said hashmaps) in a lazy loading context (without loading the whole lists), excluding using queries.

edit
delete
#4

This subsequent question is unrelated to the subject of this thread ("Is it possible to commit only specific elements"), so please use a new separate thread with a matching title.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.