...
Nothing fancy here. Now open BlogEntry.java and add the following method:
Code Block |
---|
@Override public void awakeFromInsertion(EOEditingContext editingContext) { super.awakeFromInsertion(editingContext); NSTimestamp this.setCreationDate(now = new NSTimestamp(); setCreationDate(now); setLastModified(now); } |
Why are we adding this? awakeFromInsertion is a very good way of setting default values when creating a new instance of a Enterprise Object (EO). In this case, we want to set automatically the creation date and last modification dates without having the user to add that valuethose values.
Now, let's use migrations to actually create the database.
...