Hi Thiago, would you happen to know of a better way of handling this issue?
The only way I was able to get things working was with the following code. I
feel it's very poorly written, however the add row component needs the
purchaseRequest object to be persisted. Instantiating purchaseRequest object
in the onPrepare methed causes it to be overwritten onSuccess.  Thanks


    @PageActivationContext
    private PurchaseRequest _purchaseRequest;

    @Property
    @Persist
    private PurchaseRequest purchaseRequest;

    void setupRender() {
        if(_purchaseRequest == null) {
            purchaseRequest = new PurchaseRequest();
        } else {
            title = "Update Purchase Request";
            purchaseRequest = null;
            purchaseRequest = _purchaseRequest;
        }
        
    }

    @CommitAfter
    Object onSuccessFromPR() {
        if (session.contains(_purchaseRequest)) {
            session.evict(_purchaseRequest);
        }
       
        if(purchaseRequest.getId() != null) {
            session.merge(purchaseRequest);
        } else {
            session.save(purchaseRequest);
        }

        return
_pageRenderLinkSource.createPageRenderLinkWithContext(Purchase_Request.class,
purchaseRequest.getId());
    }



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-PageActivationContext-with-Persist-tp4532281p4532489.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to