Hi fellows,

Last time I asked how to use chain in CompoundPropertyModel with
LoadableDetachableModel, it worked since my page has no form (no submit).
This time, I make another page and try to use the chain again, and hibernate
throws org.hibernate.NonUniqueObjectException when I submit the form.

Caused by: org.hibernate.NonUniqueObjectException: a different object with
the same identifier value was already associated with the session:
[datastore2.model.DataStoreRole#1]

My Panel:

public UserDetail(String id, DataStoreUser user, final Panel prevPanel) {
        super(id);
        add(new FeedbackPanel("feedback"));

        add(new Link("back") {
            public void onClick() {
                getParent().replaceWith(prevPanel);
            }
        });

        Form form = new Form("form") {
            protected void onSubmit() {
                DataStoreUser user = (DataStoreUser)this.getModelObject();
                try {
                    getDelegate().saveUser(user);
                    info("You have saved the user profile: " +
user.getFullname() + ".");
                } catch (Exception e) {
                    e.printStackTrace();
                    error("Your user profile state is stale (someone has
updated the same user profile while you are on this page). Please press BACK
and come back.");
                }
            }
        };

        form.setModel(new CompoundPropertyModel(new
LoadableDataStoreUserModel(getDelegate().getDataStoreUser(user.getId()))));
        form.add(new Label("id"));
        form.add(new Label("username"));
        form.add(new RequiredTextField("firstname"));
        form.add(new
TextField("lastname").setConvertEmptyInputStringToNull(false));
        form.add(new Label("email"));
        form.add(new Palette("roles", new
Model((Serializable)getDelegate().getDataStoreRoles()), new
RoleChoiceRenderer(), 10, true));
        add(form);
    }

Is LoadableDetachableModel working for form processing? Because it is
working if I only have 
form.setModel(new
CompoundPropertyModel(getDelegate().getDataStoreUser(user.getId())));

The reason why i want this loadable since I want to update the page with
"F5" refresh button again if someone has changed the same user in another
computer.

Thank you :)
Matthew Kwong
-- 
View this message in context: 
http://www.nabble.com/LoadableDetachableModel-in-form-processing-tf3204839.html#a8899449
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to