On Wed, Jan 28, 2009 at 1:20 AM, Henry <[email protected]> wrote: > - Do you have Save() that automatically determines calling Create or > Update? determined by isDirty flag?
Handled by Transfer / Hibernate so I don't need to worry about it. > - What other methods do you have in DAO beside CRUD? I lean toward data gateways, not DAOs, and have all my aggregate access methods in my data gateways - as well as using them to wrap CRUD (which is handled by Transfer / Hibernate). > - Do you usually delete, or soft-delete (set a isDeleted bit on the > record)? Would you still name the soft-delete function delete()? It depends on the business requirements. Sometimes soft-delete is required, sometimes not. I like Brian's approach of overriding .delete() to handle soft-delete. > - Does CRUD all takes in the bean as the argument? or just beanID for > read() and delete()? Transfer / Hibernate determines the approach here: get by PK, delete by bean (and save by bean, of course). > - Do CRUD methods return boolean for success or fail, or throw the > actual database exception if error occurs? Throw exceptions. The result is the bean being operated on. Boolean results are evil (as are any kind of success/fail flags in general when the natural return type is not YES/NO). > - Lazy-loading to all children properties? Depends. Again, Transfer / Hibernate takes care of that. > - Assuming you have no Gateway object, do you return a collection of > objects or a query? or.. IBO? Depends. Transfer manages arrays/structs of objects for relationships but for aggregate gateway queries I tend to return query results. Hibernate returns collections of objects (and Java object creation is fast enough to make that always viable). > - Do you have separate methods for returning array / query? Or one > method that's based on a returnType parameter? Depends. If I need both, it's usually encoded into the name of the method. Transfer has getFooArray() / getFooStruct() depending on how the relationship is defined. I sometimes add getFooQuery() or, more often, getParentBarQuery(). -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ "If you're not annoying somebody, you're not really alive." -- Margaret Atwood --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
