Team,

I'm sure this has been solved before - repeatedly, but I can't seem to find
what I'm looking for. 

I'm using Stripes 1.5 with Apache Cayenne 3.0M6. 

Creation of new object is a snap, I can simply pass the object to Stripes
and it does a perfect job populating the fields so that Cayenne can persist.
My issue is with Updating existing data.

I'm attempting (unless there is a better pattern) to reuse the same Bean
with a different event for "modify". The link is generated with an:
<s:link beanclass="fooBean" event="modify"><s:param name="user.pkId"
value="${fooId}"/></s:link> 
The end results looks correct. 

My first question is: When and Where should I "populate/inflate" the object
to be edited? I think I've simply confused myself by reading a little too
much and mixing patterns of others... 

I've tried using inflating the object using a @Before annotation:
        @Before(stages = { LifecycleStage.BindingAndValidation })
        public void fillData()
        {
             // time to inflate the object for the user             
        }
BUT -- at that stage (err - I think) I don't seem to have the anything from
the request? I would expect (and be wrong) that my user object would be
empty EXCEPT for the pkId attribute. The entire object is empty...
Interesting enough if I get the parameter from the request directly it
works, but this seems so hacky:

int thisPkId = getUser().getPkId(); // does not work! 
String strUid = getContext().getRequest().getParameter("user.pkId"); // this
works...

So - let me cut to the chase.. 

What is "A" recommend pattern to inflate an object based on a parameter
passed in? If I attempt to re-load the object before I call "update" I
overwrite the request params... 

Thanks all! 


The "ID" parameter in Cayenne is  
-- 
View this message in context: 
http://www.nabble.com/Correct-Pattern-for-CRUD-when-ID-field-is-complex-tp25754729p25754729.html
Sent from the stripes-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to