I was trying to wrap my head around the idea for a couple of days, so here is my thoughts so far...
BTW here are a few similar proposals by David Marko: this one: https://issues.apache.org/jira/browse/CAY-877 and especially this one: https://issues.apache.org/jira/browse/CAY-988 Here all the neat APIs do not start from the object itself, but instead from something called CayenneObjectManager (a wrapper for thread-bound ObjectContext I presume). Its create/delete/save ops do not provide much advantage over ObjectContext. Its query builder facilities we are planning to emulate anyways. So to me CayenneObjectManager is essentially a placeholder for a more friendly SelectQuery. Which is great as it is of course, but my conclusion from it is that we just need to work on that better SelectQuery (which is happening in 3.2 as we speak). Now in Ruby (which I barely know) I suppose ActiveRecord is such a great RAD technology, because when you control the DB, you can sort of avoid (or minimize) the *mapping* step. In Cayenne you still need to do the mapping. Once you did it, our current or planned API could be as friendly as it gets. So with this in mind, is there any advantage to keeping all the persistence-related methods as generated methods on the class? Is this just to simplify the picture for the folks who don't want to know anything about ObjectContext? This is an honest question, I am trying to understand whether it will be that much more straightforward. Andrus On Dec 19, 2012, at 11:07 PM, Дробеня Илья <[email protected]> wrote: > 2012/12/19 Michael Gentry <[email protected]> > >> One of the dangers of having delete/save/update > > Update method do not needed, delete method is useful - because it remove > entity from context. > And instead of save method - we may create methods - seems like > commitContext, rollbackContext. > > Also we may create it in "Role" for example, or we may create static class > for example "Cayenne" or move its to "AnythingMap". > > Role curRole = Role.newInstance(); > curRole.setFirstName("Ilya"); > > SecurityMap.commitContext(); > > What do you think? > > > > -- > С уважением, Илья Дробеня.
