views:

40

answers:

3

If the solution is to override init() and del() from db.Model / db.Expando / db.PolyModel, then do I need to call the superclass functions?

Would be great to see some example code in the answers or on links. Thanks a lot.

+1  A: 

I think that the best way to accomplish what you want to do is to use datastore API hooks.

Using that approach will allow you to avoid messing directly with the classes and superclasses. That could get complex and messy and buggy very quickly.

Adam Crossland
+1  A: 

If this is the java implementation, you can implement javax.jdo.listener.StoreCallback on your domain model and then define method jdoPreStore(). This method will automatically be called each time you persist to the datastore.

Brad
+1  A: 

I've written a couple of blog posts on this subject: One on high level pre- and post- put hooks, and one on the low level hook support. One of these is probably what you're looking for.

Nick Johnson