I'm not familiar with the Pet Store example, so I'm not sure what was meant by it not being a best practices example. Also, people have many different ideas of what they think a best practice is, so it can vary greatly.
My typical usage is to put my custom business logic in the Cayenne-generated subclass and to also put my "fetch" type methods in there, too (when not creating them in Cayenne Modeler). The more interesting questions (to me) are what are the usage patterns, etc. That helps determine how to use the DataContext (or ObjectContext), how to do data refreshing, etc. One application I did had a single read-mostly DC that I synchronized access to for all the users (the queries took a prohibitive amount of time for interactive usage, so I cached things in a single DC). Others I used one (or more) DCs per user's session. Again, it really depends upon what your requirements are for data access. Feel free to ask more questions. Hope that helped just a little. mrg On Mon, Apr 20, 2009 at 3:30 PM, Ylan Segal <[email protected]> wrote: > Hi Everyone, > > I am new to Cayenne. I was looking at the examples in the wiki, especially > at the pet store: > > http://cwiki.apache.org/CAY/cayenne-petstore.html > > So far, I like what I see. The above page does mention that the pet store > example "... definitely needs a rewrite and DB redesign before we can call > it Cayenne Best Practices Demo." > > Why isn't it a best practice? Because of the DB design or because of how > Cayenne classes are used? The overall app design (one domain package, one > DAO package, one presentation package) seems reasonable to me. I would be > designing a DB schema from scratch for a web application (probably with > struts), and I am thinking of following the example pattern, assuming that > pattern is not what needs rewriting! Can anyone suggest best practices for > this type of situation? I am looking for more of a "what packages should we > have" discussion rather than a "this is how you save an object to the > database" discussion. > > I hope this makes sense. > > -- > Ylan Segal > [email protected] > >
