Hi,
   I have a form with email and name fields, and when the page is activated,
it will retrieve an existing application, then initialize email and name,
when submit is clicked, 
   a Profile record is created in onSuccess and persisted, the following
code seems not working, what is a right practice in this use case?  
Thanks,
   

public class MakeProfile {

    @Inject
    private Session session;

    @Property
    private String email;
    @Property
    private String name;

        private Application app;
 
    void onActivate(String code_ref) {
        app = (Applicantion) session().createQuery("from Applicantion where
code = ?").setString(0, code_ref).uniqueResult();
        if (app != null) {
                        email = app.getEmail();
                        name = app.getName();
      }
    }

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

}


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/t5-create-a-record-from-another-table-what-is-best-practice-tp4307107p4307107.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