Here's the code I use to attribute a comment to a user (following a user's relationship to the comment) when it is initialized: public Comment aComment() { Comment aComment = (Comment) commentDisplayGroup.selectedObject(); // create a new comment on demand if (aComment == null) { // get user ApplicationUser aUser = (ApplicationUser) valueForKeyPath("session.user"); // insert a new comment commentDisplayGroup.insert(); // assign the timestamp aComment = (Comment) commentDisplayGroup.selectedObject(); aComment.setTimestamp(new NSTimestamp()); System.out.println("Setting the date: " + aComment.timestamp()); // assign the user aComment.addObjectToBothSidesOfRelationshipWithKey(aUser,"applicationUser"); } return aComment; } On 18 May 2006, at 10:12 AM, David Avendasora wrote:
-- It's like driving a car at night. You never see further than your headlights, but you can make the whole trip that way. E. L. Doctorow from Sunbeams: http://www.thesunmagazine.org |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to archive@mail-archive.com