>Hi,
>are you sure your model is a LDM?

Yes. Sure. Encapsulated by an CompoundPropertyModel.
-------
new CompoundPropertyModel(scaffoldableModel)
-------
/*
                 * Need this because wicket serializes everything and need to 
reload
it when
                 * it's needed. This way wicket and hibernate plays well
                 */
                IModel<Lead> scaffoldableModel = new
LoadableHibernateModelImpl<Lead>(getFirst())
                {
                        /**
                         * 
                         */
                        private static final long serialVersionUID = 1L;
                        @SpringBean(name = "leadDAOBean")
                        private LeadDAO leadDAO;
                        private UuidUserType uuid;
                        
                        @Override
                        protected Lead load() {
                                Lead lead = null;
                                if(uuid!=null)
                                {
                                        lead = leadDAO.find(uuid);
                                        
                                }
                                return lead;
                        }

                        @Override
                        protected void setNonTransientObject() {
                                Lead lead =  this.getObject();
                                if(lead!=null)
                                        uuid = lead.getUuid();
                        }

                        
                };

--------
And...
---------
public abstract class LoadableHibernateModelImpl<T> extends
LoadableDetachableModel<T> 
        implements LoadableHibernateModel<T>, IModel<T>
---------

detach and load got called. So it's working. The problem seems to be
transactions.

I used to reload the model in the onBeforeRender functions. This made
wicked open a transaction that continued until the save. But now I made
things different (more efficient). The problem now is how to get a
transaction run during the model update and save.



>>IIRC you have a ListView involved. What's the type of 
>>this.getDefaultModel() ?

I checked this to make sure is the correct model. What I do is to set a
wrapper around. The component I use extends from panel and inside there
is a form and some other components that must use the model of the
panel. So I wrap it around with CompoundPropertyModel.

---------------
        public ScaffoldingForm(String id, IModel<T> scaffoldableModel) {
                //super(id, scaffoldableModel);
                super(id, new CompoundPropertyModel(scaffoldableModel));
---------------

The returning model is the CompoundPropertyModel. So seems to be ok.


Thank you in advance Sven.
I will try to make everything run in a unique transaction. I found this:
http://apache-wicket.1842946.n4.nabble.com/OpenSessionInView-OSIV-LoadableDetachableModel-and-Transactions-td1858513.html

Maybe someone else have any other useful link.

Thank you again.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to