On 20/12/12 4:18am, Andrus Adamchik wrote:
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.
To an extent. ActiveRecord (and most of Rails) is configuration by convention. So, primary keys are always named "id". Foreign keys have special names pointing to the table. You can add something similar to annotations to the persisted entities if you want to change the defaults. Interestingly, there is still a schema.rb which looks just like a dictionary for the database entities (including indexes). Rails generates it for you from the database as you work, but it is still there.
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.
There is a lot to be learnt from ActiveRecord's fluent API. So easy to read and very concise. Some of that clean API comes from the abilities of Ruby itself (which Java cannot accomplish). But I can't quite see the point of hiding the concept of Contexts from the user. Most users new to Cayenne will understand what 'database transaction' means and quickly understand Context as a similar idea. If we hide context from the user in this API, does this throw an exception? Or is localObject() implicit in every setter? Artist a = Artist.newInstance(); a.setName("Bob"); a.save() Painting p = Painting.newInstance(); p.setArtist(a); p.save(); Ari -- --------------------------> Aristedes Maniatis GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A