Its probably not fool-proof, but it has worked fine up till now........


public class MyLDM<T extends MyDomainModelIF> extends
LoadableDetachableModel{

        private MyServiceIF<T> modelLoaderService;
        private Long id;

        /**
         * Constructor.
         *
         * @param object the model to make 'detachable'
         * @param modelLoaderService used to load the model
         */
        public MyLDM(T object, MyServiceIF<T> modelLoaderService){
        super(object);
        this.modelLoaderService = modelLoaderService;
                this.id = object.getId();
        }

        public MyLDM(Long id){
                super();
                this.id = id;
        }

        @Override
        protected T load() {
                return modelLoaderService.load(id);
        }

    
      public void setId(Long id) {
          this.id = id;
      }

   
     @Override
     @SuppressWarnings("unchecked")
     public T getObject(){
         return (T)super.getObject();
     }
}

igor.vaynberg wrote:
> 
> what is your ldm implementation look like?
> 
> and yes, delayed construction is always the way to go.
> 
> -igor
> 
> On Wed, Oct 29, 2008 at 7:44 AM, Neil McT <[EMAIL PROTECTED]>
> wrote:
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/LazyInit-error-with-LDM-in-a-panel-tp20228580p20231137.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to