I always ask Google for everything. I don't have a brain anymore. The Cayenne in Motion example is old, but still pretty valid (except for package names that have changed).
The JavaDoc could be improved upon, certainly. There are a few exceptions that commitChanges() will throw, but you don't have to catch them if you don't want -- depends on your use. Of course, catching is usually nicer. :-) On Tue, Feb 21, 2012 at 12:28 PM, Durchholz, Joachim <[email protected]> wrote: >> 1) In Cayenne Modeler, select an ObjEntity (the Java class) and >> under the Entity tab, turn Optimistic Locking on. Then under >> the Attributes tab, turn Used for Locking on for each attribute >> you wish to lock on (you can do the same for Relationships if you >> desire). > > Thanks, that's what I missed. > > Oh right, it's in the FAQ, not in the JavaDoc. > Finally thought of asking Google. D'oh. > > Though the only other page that mentions it is > https://cwiki.apache.org/CAY/cayenne-in-motion.html . (It's ancient, > uses Cayenne 1.1 or 1.2. Not sure whether it's still up-to-date. I > tend to avoid ancient examples, which is why I missed that one in the > first place.) > > The Javadoc for the commit functions should at least mention that > they might throw an optimistic locking exception. And what the class > of that exception is so people can write try...catch clauses. > And the Cayenne user guide should mention it, as part of the commit > stuff (here we're back at transactions ;-)). And maybe there should > be mention how to enable it if one is not using Modeler. > > Sorry for all those nitty-gritty details, and I apologize for the > inconvenience if I just overlooked it in the docs.
