Re: Local instance of EOF returning null
Re: Local instance of EOF returning null
- Subject: Re: Local instance of EOF returning null
- From: Chuck Hill <email@hidden>
- Date: Sun, 02 Oct 2011 18:29:12 -0700
This can only be done between a parent and child EC.
On 2011-10-02, at 4:32 PM, Pascal Robert wrote:
> I'm working on a page for WOWOC where potentials presenters could submit their papers (presentation suggestions). I'm using the HTML routing stuff from ERRest, so in my controller, I'm doing:
>
> public WOActionResults createPaperAction() throws Throwable {
> Member presenter = null;
> String tokenValue = this.request().cookieValueForKey("wowodcToken");
> if (tokenValue != null) {
> String username = crypter.decrypt(tokenValue);
> presenter = Member.fetchMember(editingContext(), Member.USERNAME.eq(username));
> }
>
> if (presenter != null) {
> Conference conference = Conference.fetchConference(editingContext(), Conference.NAME.eq("WOWODC 2012"));
> ConferenceSession newPresentation = ConferenceSession.createConferenceSession(editingContext(), conference);
> newPresentation.addToPresentersRelationship(presenter);
> PaperUpdate nextPage = pageWithName(PaperUpdate.class);
> nextPage.setConfSessionItem(newPresentation);
> return nextPage;
> }
> return errorResponse(ERXHttpStatusCodes.STATUS_FORBIDDEN);
> }
>
> And in the component:
>
> protected EOEditingContext editingContext() {
> if (_editingContext == null) {
> _editingContext = ERXEC.newEditingContext();
> }
> return _editingContext;
> }
>
> public void setConfSessionItem(ConferenceSession confSessionItem) {
> this._confSessionItem = ERXEOControlUtilities.localInstanceOfObject(editingContext(), confSessionItem);
> }
>
> Problem is: localInstanceOfObject always returns null... unless that before I'm calling setConfSessionItem, if I call editingContext().saveChanges, now localInstanceOfObject. But I don't want to save the EO before moving to a new EC, so what is the recipe to move an EO to another EC when the EO have not been saved?
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden