Cayenne has nice-looking modeling tools and a decent API, but has other interesting limitations in their prefetching
Here are a few things I noticed about the framework:
Their explanation of how many queries it takes to get a list of objects, each with 1-n sublink is confusing, at best. I expect it to take exactly one (1) query ... they say two? ... oh, Lord, check out the lovely syntax they have in the "advanced" section below:
query.addPrefetch("paintingArray").setSemantics(
PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
Intuitive and beautiful.
Transaction.bindThreadTransaction(tx);
try {
// do something...
....
// if no failures, commit
tx.commit();
}
catch (Exception ex) {
tx.setRollbackOnly();
}
finally {
Transaction.bindThreadTransaction(null);
if (tx.getStatus() == Transaction.STATUS_MARKED_ROLLEDBACK) {
try {
tx.rollback();
}
catch (Exception rollbackEx) {
}
}
}
On the other hand, there is this:
Cayenne ensures that each ObjectContext contains at most one instance of each unique persistent object. In other words if two separate independent queries fetched a row with the same primary key, the same object instance will be used in both results. This behavior (not supported by some other frameworks), is extremely important in maintaining consistency of the object graph.
There is also a good page on Object Caching, which explains how objects synchronization is maintained across JVMs. The only line to cause some worry is this one: "Due to concurrency issues discussed above, if a snapshot version conflict occurs, DataRowStore removes a given snapshot from the cache to avoid dealing with concurrency effects on merging." Does this mean that data is lost?
Sign up for our Newsletter