Hello, I'm trying figure out how to use the annotation @Persist with
@PageActivationContext.

When purchaseRequest is null, I need to have the ability to create a new one
and persist it so that I can continue to set purchaseRequest with other ajax
components such as add row. I also need to be able to retrieve existing data
and once again persist the object for ajax interactions. 

This is my code. 

    @PageActivationContext
    @Persist
    @Property
    private PurchaseRequest purchaseRequest;

   void pageReset() {
       purchaseRequest = null
   }

    void onPrepare() {
        if(purchaseRequest== null) {
            purchaseRequest = new purchaseRequest();
        }
    }

    Funding onAddRow() {
        Funding newFunding = new Funding();

        purchaseRequest.getFundings().add(newFunding);
        newFunding.setPurchaseRequest(purchaseRequest);

        return newFunding;
    }

I'm getting the following error

java.lang.IllegalStateException
Entity com.mycompany.rolemanager.entities.PurchaseRequest@4a4890 has an id
property of null; this probably means that it has not been persisted yet.

#
org.apache.tapestry5.internal.hibernate.HibernateEntityValueEncoder.toClient(HibernateEntityValueEncoder.java:66)
#
org.apache.tapestry5.internal.services.ContextValueEncoderImpl.toClient(ContextValueEncoderImpl.java:37)
#
$ContextValueEncoder_130d6aa53f5.toClient($ContextValueEncoder_130d6aa53f5.java)
#
org.apache.tapestry5.internal.services.ContextPathEncoderImpl.encodeValue(ContextPathEncoderImpl.java:48)
#
org.apache.tapestry5.internal.services.ContextPathEncoderImpl.encodeIntoPath(ContextPathEncoderImpl.java:72)
#
$ContextPathEncoder_130d6aa53ea.encodeIntoPath($ContextPathEncoder_130d6aa53ea.java)
#
org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.appendContext(ComponentEventLinkEncoderImpl.java:339)
#
org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.createComponentEventLink(ComponentEventLinkEncoderImpl.java:198)
#
org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor.createComponentEventLink(LinkTransformerInterceptor.java:44)
 


Any help would be greatly appreciated.


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/T5-PageActivationContext-with-Persist-tp4532281p4532281.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