Would it be possible to use a PersistentEntityStore and one or more plain Store instances in the same Environment instance? I was hoping to use transactions that cover changes on such a combination. I see potential conflicts with store names that I would have to avoid. Anything else?
It's possible to mix code using different API layers inside a single transaction. The only requirement is the data touched by different API should be isolated, disjoint sets of names of Stores
should be used.
What are the names of Stores
used by PersistentEntityStore
? Any PersistentEntityStore
has its own unique name, and names of all Stores
, that represent mapping of the entity store to key/value layer, start with "${PersistentEntityStore name}."
, as it's specified in the source code.
Another issue is that API is not complete for such approach. After a StoreTransaction
is created against the PersistentEntityStore
, it should be be cast to PersistentStoreTransaction
in order to call PersistentStoreTransaction#getEnvironmentTransaction()
for getting underlying transaction:
final StoreTransaction txn = entityStore.beginTransaction();
// here is underlying Transaction instance:
final Transaction envTxn = ((PersistentStoreTransaction) txn).getEnvironmentTransaction();