How best to unbind all names?

#1

My JDO application does inserts with binds, and then subsequently does bulk deletes using this code:

pm.currentTransaction().begin();
Extent<ABC> extent = pm.getExtent(ABC.class, true);
Query q = pm.newQuery(extent);
long deletedCount = q.deletePersistentAll();
pm.currentTransaction().commit();

The volumes of items could be large so I am concerned that I will get a build-up of "orphan" bindings (bookmarks). Instead of the above code, I could iterate over the Extent and delete the entities and the bindings one at a time, but this seems less efficient.

Any views on this - thanks!

#2

Are you using Utilities.bind (following ObjectDB 1.x documentation)?

This is a non portable extension of ObjectDB and not part of JDO.

If you do, consider implementing bookmarks in portable way, by adding a 'name' field, which may be set as a primary key or as a unique index. This will also solve the orphan problem.

 

ObjectDB Support
#3

Yes, I was using Utilities.bind.

The reason for this was I presumed that it would provide fast lookup, and the bookmark name I use is in fact simply the object primary key (a String).

The free edition of objectdb does not provide indexes, so I was concerned that using JDO queries even on the primary key would be slow. The created schema is in fact recognizing the existence of the primary key - it shows a "k" by the field in Object explorer.

So, can I get fast primary key lookup in the free edition? Is there any particular way the object retrieval query by PK should be created?

Thanks.

 

#4

ObjectDB 2.x free edition supports indexes.

The only restrictions are in the number of classes (10) and objects (1000000).

It is true that in ObjectDB 1.x the free edition had no index support.

ObjectDB Support

Reply