After the last application developed using Roma Meta Framework I spent much time to refactor and optimize the performance of PersistenceAspect module. Until now Roma always used the JDO detaching mode. It works very well for the most cases, but when you had to execute many operations inside the same transaction or when you don't need to have the objects writeable.
JDO Detaching consumes a lot of CPU resources since the objects are copied and memory since for the same reason. For normal CRUD operation the difference is trascurable, but in long transactions is very sensible.
For this reason I've refactored the PersistenceAspect to have 3 implementations:
- AtomicPersistenceAspect: operations are always atomic and it continue to uses the "classic" detach mode.
- TxPersistenceAspect: operations share the same transaction (you had to call commit/rollback methods!) and you can access to the objects also after the commit/rollback in read-only mode
- NoTxPersistenceAspect: No transaction is used and you can access to the objects also after the commit/rollback in read-only mode
Furthermore you can select the strategy also when you retrieve the object by:
In the next week I'll migrate all CRUD operations to use the NoTx Strategy.
I started also to write a detailed HowTo about the Persistence Strategy.