• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EOModeling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOModeling


  • Subject: Re: EOModeling
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 12 Jan 2004 11:54:20 -0800
  • Organization: Global Village Consulting, Inc.

What this won't do is to set the last update date when the object is later modified. You may be tempted to do thing in validateForSave. Don't. It will eventually bring you grief.

The best way I know of to handle this is to create an ec sub-class that involved the eo in state changes (willUpdate, willDelete, didDelete, didUpdate etc.). I'm pretty sure there is one on Project WONDER. There might also be examples on wocode or wodev.

Chuck


Drew Thoeni wrote:

Like Karl, I leave them in each class (or table at the database level).

If you are using OpenBase, it defaults a timestamp (_timestamp) automatically.

Here's the code Karl spoke of. It took me a bit to figure this out when I first ran into it. The code goes into the class.java file (where class is the class name). "setLastUpdate" is an example set method in this class. Your's will be whatever you call it. In this example, the timestamp gets set when a new object is created using the class definition. If you then allow the user to edit the object on a web page, time passes. So the timestamp can be off by the difference in how long it takes the user to edit and then save the object.


public void awakeFromInsertion(EOEditingContext ec) { super.awakeFromInsertion(ec); setLastUpdate(new NSTimestamp()); }

Drew

On Jan 10, 2004, at 11:56 AM, james cicenia wrote:

First I want to thank everyone who has replied to my "newbie" thread.

I have now refactored my design to break up my "Project" table to actually
be three ala Chuck's advice.


My new question is... I like to have audit fields in my databases so that
every row is stamped with a creation date/user and last mod date/user.


Should I start a separate base object that includes these "audit" attributes
and then create a corresponding "audit" table in the database? Or, should
I just leave them as attributes in my classes and just store the attributes as
columns in the database?


thanks again.

-James
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

--

Chuck Hill                                 email@hidden
Global Village Consulting Inc.             http://www.global-village.net

Progress is the mother of all problems.
- G. K. Chesterton
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: EOModeling
      • From: Pierre Frisch <email@hidden>
References: 
 >EOModeling (From: james cicenia <email@hidden>)
 >Re: EOModeling (From: Drew Thoeni <email@hidden>)

  • Prev by Date: Re: Strings and Timestamps
  • Next by Date: Re: EOModeler
  • Previous by thread: Re: EOModeling
  • Next by thread: Re: EOModeling
  • Index(es):
    • Date
    • Thread