Query for objects persisted within the same transaction

#1

I have a question concerning reading uncommited entities with query, within active transaction.

For example, I read data from file. Each line contains value of one of entity's attributes but those values are not unique, so it's possible to have a multiple instances of the same entity. To eliminate duplicates, after reading every line I first check using a query, if an entity with that attribute value already exists. If no - I create one and persist it.

The problem is, that each entity created and persisted withing current transaction is invisible to future queries in this transaction, unless I do commit. The ugly solution is to use some external list or map to check if given entity was persisted.

#2
ObjectDB Support
#3
Thanks, The part about performance in documentation is so true. I think I'll stick with map to check for duplicates, as performance drop is like 20x - just tested.

Reply