You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by vov <vo...@mail.ru> on 2010/07/15 11:10:40 UTC

Re: Wicket's Form Model (using hibernate entity or value objects) Design

see org.apache.wicket.model.LoadableDetachableModel
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Re-Wicket-s-Form-Model-using-hibernate-entity-or-value-objects-Design-tp2289854p2289870.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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


Re: Wicket's Form Model (using hibernate entity or value objects) Design

Posted by Nivedan Nadaraj <sh...@gmail.com>.
James
Thanks mate. I have couple of options i guess that is what pedro meant as
well. I guess Jeremy's solution is what i was looking for. in that the form
instance will have a CPM that refers a container bean that has members.

The solution u provided also is the identical but the members are in a
panel. Cool.
Thanks for the time,
Niv

On Fri, Jul 16, 2010 at 11:04 PM, James Carman
<ja...@carmanconsulting.com>wrote:

> You could put your components for editing the two different objects
> onto two different panels, which each have a CPM inside your form.
>
> On Fri, Jul 16, 2010 at 7:29 AM, Nivedan Nadaraj <sh...@gmail.com>
> wrote:
> > Thanks. How do i let the form know that it has one or more models? In the
> > above I invoke the
> > super(id, new CompoundPropertyModel<Study>(study)); So this wraps the
> model
> > as study. How will be able to add the second model in the same manner?
> > If it sounds too basic do bear with me I will experiment as well.
> >
> > Thanks again
> > Niv
> >
> >
> > On Fri, Jul 16, 2010 at 7:04 PM, James Carman <
> james@carmanconsulting.com>wrote:
> >
> >> Your form can edit two different objects.   It will edit whatever you
> bind
> >> your fields to
> >>
> >> On Jul 16, 2010 4:23 AM, "Nivedan Nadaraj" <sh...@gmail.com>
> wrote:
> >> > Hi
> >> > Thanks for the pointer. I did read through models and
> >> > LoadableDetachableModel. Not sure if this model addresses the problem
> at
> >> > hand. Isn't LDM related to performance and resoles
> >> > Serialization issues? In the same note I came across Chaining of
> models.
> >> or
> >> > Nesting of Models...can you/someone give me more information on it.
> >> >
> >> > Probably I should have mentioned that I wrap my hibernate entity in a
> >> > CompoundPropertyModel like this
> >> >
> >> > MyForm extends Form{
> >> >
> >> > MyForm( new CompoundPropertyModel(studyEntity));
> >> > //I also want to be able to add another model that will capture input
> >> > from the form.e.g LdapStudy
> >> >
> >> > }
> >> >
> >> >
> >> > Any pointers will be great thanks again for the time
> >> >
> >> > Nive
> >> > On Thu, Jul 15, 2010 at 5:10 PM, vov <vo...@mail.ru> wrote:
> >> >
> >> >>
> >> >> see org.apache.wicket.model.LoadableDetachableModel
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> >>
> http://apache-wicket.1842946.n4.nabble.com/Re-Wicket-s-Form-Model-using-hibernate-entity-or-value-objects-Design-tp2289854p2289870.html
> >> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >> >>
> >> >> ---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wicket's Form Model (using hibernate entity or value objects) Design

Posted by James Carman <ja...@carmanconsulting.com>.
You could put your components for editing the two different objects
onto two different panels, which each have a CPM inside your form.

On Fri, Jul 16, 2010 at 7:29 AM, Nivedan Nadaraj <sh...@gmail.com> wrote:
> Thanks. How do i let the form know that it has one or more models? In the
> above I invoke the
> super(id, new CompoundPropertyModel<Study>(study)); So this wraps the model
> as study. How will be able to add the second model in the same manner?
> If it sounds too basic do bear with me I will experiment as well.
>
> Thanks again
> Niv
>
>
> On Fri, Jul 16, 2010 at 7:04 PM, James Carman <ja...@carmanconsulting.com>wrote:
>
>> Your form can edit two different objects.   It will edit whatever you bind
>> your fields to
>>
>> On Jul 16, 2010 4:23 AM, "Nivedan Nadaraj" <sh...@gmail.com> wrote:
>> > Hi
>> > Thanks for the pointer. I did read through models and
>> > LoadableDetachableModel. Not sure if this model addresses the problem at
>> > hand. Isn't LDM related to performance and resoles
>> > Serialization issues? In the same note I came across Chaining of models.
>> or
>> > Nesting of Models...can you/someone give me more information on it.
>> >
>> > Probably I should have mentioned that I wrap my hibernate entity in a
>> > CompoundPropertyModel like this
>> >
>> > MyForm extends Form{
>> >
>> > MyForm( new CompoundPropertyModel(studyEntity));
>> > //I also want to be able to add another model that will capture input
>> > from the form.e.g LdapStudy
>> >
>> > }
>> >
>> >
>> > Any pointers will be great thanks again for the time
>> >
>> > Nive
>> > On Thu, Jul 15, 2010 at 5:10 PM, vov <vo...@mail.ru> wrote:
>> >
>> >>
>> >> see org.apache.wicket.model.LoadableDetachableModel
>> >> --
>> >> View this message in context:
>> >>
>>
>> http://apache-wicket.1842946.n4.nabble.com/Re-Wicket-s-Form-Model-using-hibernate-entity-or-value-objects-Design-tp2289854p2289870.html
>> >> Sent from the Wicket - User mailing list archive at Nabble.com.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>>
>

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


Re: Wicket's Form Model (using hibernate entity or value objects) Design

Posted by Nivedan Nadaraj <sh...@gmail.com>.
HI Pedro
Thanks for taking the time. I really appreaciate this community and love it.

What Jeremy mentioned provided the solution where in the we let wicket use
the hierarchy to use the model class that contains other beans and
introspect the property expression and set/get values. That way the panel is
not holding on to the beans.

I see your point to and i will try that as well. You have also provided a
solution on the same basis ie have private members in a panel. Thanks again.
I will get back to you on this.

Thanks a lot
Niv

On Fri, Jul 16, 2010 at 9:52 PM, Pedro Santos <pe...@gmail.com> wrote:

> Hi Nivedan, Jeremy write " IModel<foo> as a private variable" and James
> "Your form can edit two different objects.   It will edit whatever you bind
> your fields to"
>
> If you have an form with some fields for some bean, and other fields for
> other beans, you can do something like:
>
> class panel {
>  private modelForAnPropertyInSomeBean;
>  private modelForAnPropertyInSomeOtherBean;
>  some code block{
>    add(new textfield( id, modelForAnPropertyInSomeBean);
>    add(new textfield( id, modelForAnPropertyInSomeOtherBean);
>  }
> }
>
> Is this what you want?
>
> On Fri, Jul 16, 2010 at 10:43 AM, Nivedan Nadaraj <shravannive@gmail.com
> >wrote:
>
> > Hi Jeremy,
> > Nice I follow you now. I can have a container java class and have any
> > number
> > of member variables which in turn can be a hibernate entity and a regular
> > java bean. The container java class will be the model. And on detach; i
> > would have to have the container java class extend IModel and implement
> the
> > detach() am i right?
> >
> > Thank you will give that a shot. Thanks for the time and thoughts.
> >
> > Regards
> > Nivedan
> >
> > On Fri, Jul 16, 2010 at 7:44 PM, Jeremy Thomerson <
> > jeremy@wickettraining.com
> > > wrote:
> >
> > > Either create a model object that contains your study and foo objects,
> or
> > > hold an IModel<foo> as a private variable. Remember it's just regular
> > java,
> > > so you can use member variables. Just don't forget to detach any model
> > you
> > > hold as a variable manually.
> > >
> > > Jeremy Thomerson
> > > -- sent from my smartphone - please excuse formatting and spelling
> errors
> > >
> > > On Jul 16, 2010 6:30 AM, "Nivedan Nadaraj" <sh...@gmail.com>
> > wrote:
> > >
> > > Thanks. How do i let the form know that it has one or more models? In
> the
> > > above I invoke the
> > > super(id, new CompoundPropertyModel<Study>(study)); So this wraps the
> > model
> > > as study. How will be able to add the second model in the same manner?
> > > If it sounds too basic do bear with me I will experiment as well.
> > >
> > > Thanks again
> > > Niv
> > >
> > >
> > > On Fri, Jul 16, 2010 at 7:04 PM, James Carman <
> > james@carmanconsulting.com
> > > >wrote:
> > >
> > >
> > > > Your form can edit two different objects. It will edit whatever you
> > bind
> > > > your fields to
> > > >
> > > > O...
> > >
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

Re: Wicket's Form Model (using hibernate entity or value objects) Design

Posted by Pedro Santos <pe...@gmail.com>.
Hi Nivedan, Jeremy write " IModel<foo> as a private variable" and James
"Your form can edit two different objects.   It will edit whatever you bind
your fields to"

If you have an form with some fields for some bean, and other fields for
other beans, you can do something like:

class panel {
  private modelForAnPropertyInSomeBean;
  private modelForAnPropertyInSomeOtherBean;
  some code block{
    add(new textfield( id, modelForAnPropertyInSomeBean);
    add(new textfield( id, modelForAnPropertyInSomeOtherBean);
  }
}

Is this what you want?

On Fri, Jul 16, 2010 at 10:43 AM, Nivedan Nadaraj <sh...@gmail.com>wrote:

> Hi Jeremy,
> Nice I follow you now. I can have a container java class and have any
> number
> of member variables which in turn can be a hibernate entity and a regular
> java bean. The container java class will be the model. And on detach; i
> would have to have the container java class extend IModel and implement the
> detach() am i right?
>
> Thank you will give that a shot. Thanks for the time and thoughts.
>
> Regards
> Nivedan
>
> On Fri, Jul 16, 2010 at 7:44 PM, Jeremy Thomerson <
> jeremy@wickettraining.com
> > wrote:
>
> > Either create a model object that contains your study and foo objects, or
> > hold an IModel<foo> as a private variable. Remember it's just regular
> java,
> > so you can use member variables. Just don't forget to detach any model
> you
> > hold as a variable manually.
> >
> > Jeremy Thomerson
> > -- sent from my smartphone - please excuse formatting and spelling errors
> >
> > On Jul 16, 2010 6:30 AM, "Nivedan Nadaraj" <sh...@gmail.com>
> wrote:
> >
> > Thanks. How do i let the form know that it has one or more models? In the
> > above I invoke the
> > super(id, new CompoundPropertyModel<Study>(study)); So this wraps the
> model
> > as study. How will be able to add the second model in the same manner?
> > If it sounds too basic do bear with me I will experiment as well.
> >
> > Thanks again
> > Niv
> >
> >
> > On Fri, Jul 16, 2010 at 7:04 PM, James Carman <
> james@carmanconsulting.com
> > >wrote:
> >
> >
> > > Your form can edit two different objects. It will edit whatever you
> bind
> > > your fields to
> > >
> > > O...
> >
>



-- 
Pedro Henrique Oliveira dos Santos

Re: Wicket's Form Model (using hibernate entity or value objects) Design

Posted by Nivedan Nadaraj <sh...@gmail.com>.
Hi Jeremy,
Nice I follow you now. I can have a container java class and have any number
of member variables which in turn can be a hibernate entity and a regular
java bean. The container java class will be the model. And on detach; i
would have to have the container java class extend IModel and implement the
detach() am i right?

Thank you will give that a shot. Thanks for the time and thoughts.

Regards
Nivedan

On Fri, Jul 16, 2010 at 7:44 PM, Jeremy Thomerson <jeremy@wickettraining.com
> wrote:

> Either create a model object that contains your study and foo objects, or
> hold an IModel<foo> as a private variable. Remember it's just regular java,
> so you can use member variables. Just don't forget to detach any model you
> hold as a variable manually.
>
> Jeremy Thomerson
> -- sent from my smartphone - please excuse formatting and spelling errors
>
> On Jul 16, 2010 6:30 AM, "Nivedan Nadaraj" <sh...@gmail.com> wrote:
>
> Thanks. How do i let the form know that it has one or more models? In the
> above I invoke the
> super(id, new CompoundPropertyModel<Study>(study)); So this wraps the model
> as study. How will be able to add the second model in the same manner?
> If it sounds too basic do bear with me I will experiment as well.
>
> Thanks again
> Niv
>
>
> On Fri, Jul 16, 2010 at 7:04 PM, James Carman <james@carmanconsulting.com
> >wrote:
>
>
> > Your form can edit two different objects. It will edit whatever you bind
> > your fields to
> >
> > O...
>

Re: Wicket's Form Model (using hibernate entity or value objects) Design

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Either create a model object that contains your study and foo objects, or
hold an IModel<foo> as a private variable. Remember it's just regular java,
so you can use member variables. Just don't forget to detach any model you
hold as a variable manually.

Jeremy Thomerson
-- sent from my smartphone - please excuse formatting and spelling errors

On Jul 16, 2010 6:30 AM, "Nivedan Nadaraj" <sh...@gmail.com> wrote:

Thanks. How do i let the form know that it has one or more models? In the
above I invoke the
super(id, new CompoundPropertyModel<Study>(study)); So this wraps the model
as study. How will be able to add the second model in the same manner?
If it sounds too basic do bear with me I will experiment as well.

Thanks again
Niv


On Fri, Jul 16, 2010 at 7:04 PM, James Carman <james@carmanconsulting.com
>wrote:


> Your form can edit two different objects. It will edit whatever you bind
> your fields to
>
> O...

Re: Wicket's Form Model (using hibernate entity or value objects) Design

Posted by Nivedan Nadaraj <sh...@gmail.com>.
Thanks. How do i let the form know that it has one or more models? In the
above I invoke the
super(id, new CompoundPropertyModel<Study>(study)); So this wraps the model
as study. How will be able to add the second model in the same manner?
If it sounds too basic do bear with me I will experiment as well.

Thanks again
Niv


On Fri, Jul 16, 2010 at 7:04 PM, James Carman <ja...@carmanconsulting.com>wrote:

> Your form can edit two different objects.   It will edit whatever you bind
> your fields to
>
> On Jul 16, 2010 4:23 AM, "Nivedan Nadaraj" <sh...@gmail.com> wrote:
> > Hi
> > Thanks for the pointer. I did read through models and
> > LoadableDetachableModel. Not sure if this model addresses the problem at
> > hand. Isn't LDM related to performance and resoles
> > Serialization issues? In the same note I came across Chaining of models.
> or
> > Nesting of Models...can you/someone give me more information on it.
> >
> > Probably I should have mentioned that I wrap my hibernate entity in a
> > CompoundPropertyModel like this
> >
> > MyForm extends Form{
> >
> > MyForm( new CompoundPropertyModel(studyEntity));
> > //I also want to be able to add another model that will capture input
> > from the form.e.g LdapStudy
> >
> > }
> >
> >
> > Any pointers will be great thanks again for the time
> >
> > Nive
> > On Thu, Jul 15, 2010 at 5:10 PM, vov <vo...@mail.ru> wrote:
> >
> >>
> >> see org.apache.wicket.model.LoadableDetachableModel
> >> --
> >> View this message in context:
> >>
>
> http://apache-wicket.1842946.n4.nabble.com/Re-Wicket-s-Form-Model-using-hibernate-entity-or-value-objects-Design-tp2289854p2289870.html
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
>

Re: Wicket's Form Model (using hibernate entity or value objects) Design

Posted by James Carman <ja...@carmanconsulting.com>.
Your form can edit two different objects.   It will edit whatever you bind
your fields to

On Jul 16, 2010 4:23 AM, "Nivedan Nadaraj" <sh...@gmail.com> wrote:
> Hi
> Thanks for the pointer. I did read through models and
> LoadableDetachableModel. Not sure if this model addresses the problem at
> hand. Isn't LDM related to performance and resoles
> Serialization issues? In the same note I came across Chaining of models.
or
> Nesting of Models...can you/someone give me more information on it.
>
> Probably I should have mentioned that I wrap my hibernate entity in a
> CompoundPropertyModel like this
>
> MyForm extends Form{
>
> MyForm( new CompoundPropertyModel(studyEntity));
> //I also want to be able to add another model that will capture input
> from the form.e.g LdapStudy
>
> }
>
>
> Any pointers will be great thanks again for the time
>
> Nive
> On Thu, Jul 15, 2010 at 5:10 PM, vov <vo...@mail.ru> wrote:
>
>>
>> see org.apache.wicket.model.LoadableDetachableModel
>> --
>> View this message in context:
>>
http://apache-wicket.1842946.n4.nabble.com/Re-Wicket-s-Form-Model-using-hibernate-entity-or-value-objects-Design-tp2289854p2289870.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>

Re: Wicket's Form Model (using hibernate entity or value objects) Design

Posted by Nivedan Nadaraj <sh...@gmail.com>.
Hi
Thanks for the pointer. I did read through models and
LoadableDetachableModel. Not sure if this model addresses the problem at
hand. Isn't LDM related to performance and resoles
Serialization issues? In the same note I came across Chaining of models. or
Nesting of Models...can you/someone give me more information on it.

Probably I should have mentioned that I wrap my hibernate entity in a
CompoundPropertyModel like this

MyForm extends Form{

   MyForm( new CompoundPropertyModel(studyEntity));
   //I also want to be able to add another model that will capture input
from the form.e.g LdapStudy

}


Any pointers will be great thanks again for the time

Nive
On Thu, Jul 15, 2010 at 5:10 PM, vov <vo...@mail.ru> wrote:

>
> see org.apache.wicket.model.LoadableDetachableModel
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Re-Wicket-s-Form-Model-using-hibernate-entity-or-value-objects-Design-tp2289854p2289870.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>