public class MakeProfile {

   @Inject
   private Session session;

   @Property
   private String email;

   @Property
   private String name;

@Property
   @Persist(PersistenceConstants.FLASH)
        private Application app;

   void onActivate(String code_ref) {
      if(app == null){
         app = (Applicantion) session().createQuery("from Applicantion where
             code = ?").setString(0, code_ref).uniqueResult();
      }
   }

   void onPrepareForRender(){
      email = app.getEmail();
      name = app.getName();
   }

   @CommitAfter
   Object onSuccess() {
       Profile p = new Profile();
       p.setEmail(email);
               p.setName(name);
               session.save(p);
       }

}

regards
Taha


On Sat, Apr 16, 2011 at 2:31 PM, Angelo C. <angelochen...@gmail.com> wrote:

> Hi,
>
> Thanks, but how to pass a string to prepareForRender?
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/t5-create-a-record-from-another-table-what-is-best-practice-tp4307107p4307173.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