I am using wicket 1.3.5 and db4o 7.4.63.11890.

My objects are being passed between pages using a subclass of
LoadableDetachableModel (see below)

My problem is:
1. I edit an object on PageA
2. I use the back button and then re-submit the form I edited and now I have
two objects in the database.

Any ideas on why this is happening?

Cheers,
Pieter


package com.musmato.wicket.model;

import org.apache.wicket.model.LoadableDetachableModel;

import com.musmato.dao.BaseFactory;

public abstract class BaseWebModel<T> extends LoadableDetachableModel {

    private static final long serialVersionUID = 1L;

    protected Long id;

    public abstract Class<T> getBaseClass();

    public abstract BaseFactory<T> getFactory();

    public BaseWebModel(Long id) {
        this.id = id;
    }

    public BaseWebModel(T object) {
        this.id = getFactory().getID(object);
    }

    @Override
    protected Object load() {

        if (id == null) {
            return getFactory().getNewObject();
        }

        return getFactory().getById(id);
    }

}

Reply via email to