because I use the domain objects directly,. without any DTO's, I have to use
the long conversation pattern. That means I have to store the domain object
somewhere in the session and let the loadabledetachable model retrieve it
from there?

2008/2/11, Igor Vaynberg <[EMAIL PROTECTED]>:
>
> then you have to use a bean, and on confirm apply changes from the
> bean to the persistent entity. the only other alternative i know of is
> to use the long conversation pattern which i am not really a fan of.
>
> -igor
>
>
> On Feb 10, 2008 11:25 PM, Martijn Lindhout <[EMAIL PROTECTED]>
> wrote:
> > ok, that makes sense.
> >
> > But what if I have a Hibernate persisted entity that I want to edit in
> > multiple actions? Say I have an order with orderlines, and I want to add
> and
> > remove them at will, and in the end save or rollback all the changes? I
> > don't want the intermediate add and removes propagate directly to the
> > database, only at 'confirm'.
> >
> >
> > 2008/2/9, Igor Vaynberg <[EMAIL PROTECTED]>:
> > >
> > > the other constructor i presume is getting a persistent entity? so
> > > hibernate/jpa will flush state back to db at the end of request, thats
> > > why that works.
> > >
> > > -igor
> > >
> > >
> > > On Feb 9, 2008 11:08 AM, Martijn Lindhout <[EMAIL PROTECTED]>
> > > wrote:
> > > > ok, thanx, that seems to work.
> > > >
> > > > And what about the other constructor, when editing an existing
> entity?
> > > >
> > > > 2008/2/9, Igor Vaynberg <[EMAIL PROTECTED]>:
> > > >
> > > > >
> > > > > setModel(new CompoundPropertyModel(new LoadableDetachableModel(){
> > > > >
> > > > > ^ that is bad because ldm is cleared between requests, thats why
> its
> > > > > called loadable
> > > > >
> > > > > just do this
> > > > >
> > > > > setModel(new CPM(new Employee()));
> > > > >
> > > > > -igor
> > > > >
> > > > >
> > > > > On Feb 9, 2008 10:45 AM, Martijn Lindhout <
> [EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I have a page, with those two constructors, the first for
> editing a
> > > new
> > > > > > employee, the second for editing an existing.
> > > > > >
> > > > > >     public EditEmployee() {
> > > > > >         setModel(new CompoundPropertyModel(new
> > > > > LoadableDetachableModel(){
> > > > > >             protected Object load() {
> > > > > >                 return new Employee();
> > > > > >             }
> > > > > >         }));
> > > > > >         init();
> > > > > >     }
> > > > > >
> > > > > >     public EditEmployee(final Long id) {
> > > > > >         setModel(new CompoundPropertyModel(new
> > > > > LoadableDetachableModel(){
> > > > > >             protected Object load() {
> > > > > >                 return empRepository.getEmployee(id);
> > > > > >             }
> > > > > >         }));
> > > > > >         init();
> > > > > >     }
> > > > > >
> > > > > > Because the Employee info is relatively much, I separate it in
> two
> > > > > panels in
> > > > > > a tabpanel. The hierarchy is: Page <- Form <- TabbedPanel <-
> several
> > > > > Panels
> > > > > > The problem is, that when I enter the formfields on the panels,
> they
> > > got
> > > > > > valided, but then a new Employee instance is created, and the
> > > > > FormComponent
> > > > > > values are not copied to the newly instantiated Employee.
> They're
> > > null.
> > > > > >
> > > > > > I did some tests and it appears that on each panel switch, the
> > > > > Model.load is
> > > > > > called, and a new Employee is returned.
> > > > > >
> > > > > > What's going wrong here....
> > > > > > --
> > > > > > Martijn Lindhout
> > > > > > JointEffort IT Services
> > > > > > http://www.jointeffort.nl
> > > > > > [EMAIL PROTECTED]
> > > > > > +31 (0)6 18 47 25 29
> > > > > >
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > Martijn Lindhout
> > > > JointEffort IT Services
> > > > http://www.jointeffort.nl
> > > > [EMAIL PROTECTED]
> > > > +31 (0)6 18 47 25 29
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > Martijn Lindhout
> > JointEffort IT Services
> > http://www.jointeffort.nl
> > [EMAIL PROTECTED]
> > +31 (0)6 18 47 25 29
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Martijn Lindhout
JointEffort IT Services
http://www.jointeffort.nl
[EMAIL PROTECTED]
+31 (0)6 18 47 25 29

Reply via email to