You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Claus Myglegaard Vagner <cv...@nordija.com> on 2006/09/21 15:31:43 UTC
BeanForm and no setter method for persistence id
Hi,
Is it possible to use the BeanForm component
(http://beanform.sourceforge.net/) for updating a pojo with no setter
method for a persistence id?
For example I have a Group object with properties id, name, description.
In the form only name and description is shown. I don't want to show the
id and I don't want to have a setId(id) method on the pojo. This should
be controlled by hibernate (with field access) completely.
When there is no setter method for id - BeanForm is returning a Group
object with a null "value" for id. This means that what should have been
an update in the database becomes an insert since hibernate thinks that
it is an not-persisted object (no id).
Why cant the BeanForm component just update the fields in action (in the
form) for the pojo e.g. just call setName and setDecription and leave
the id intact?
Regards Claus
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: BeanForm and no setter method for persistence id
Posted by D&J Gredler <dj...@gmail.com>.
Cool, thanks for the update!
On 9/22/06, Claus Myglegaard Vagner <cv...@nordija.com> wrote:
>
> Hi Daniel,
>
> You are quite right! No problem with BeanForm component. The problem
> were somewhere else in the code...
>
> Claus
>
> D&J Gredler skrev:
> > Are you listing the properties explicitly, i.e.
> > properties="name,description"? If that's the case, I don't see how the
> > BeanForm knows anything at all about your ID field. And if there's not
> > even a setId( ) method, there's no way at all for BeanForm to modify
> > the property (it doesn't modify fields directly). Is your Group object
> > marked persistent in the page specification? This sounds like a
> > problem somewhere else...
> >
> > Keep me updated,
> >
> > Daniel
> >
> >
> > On 9/21/06, *Claus Myglegaard Vagner* <cvagner@nordija.com
> > <ma...@nordija.com>> wrote:
> >
> > Hi,
> >
> > Is it possible to use the BeanForm component
> > ( http://beanform.sourceforge.net/) for updating a pojo with no
> setter
> > method for a persistence id?
> >
> > For example I have a Group object with properties id, name,
> > description.
> > In the form only name and description is shown. I don't want to
> > show the
> > id and I don't want to have a setId(id) method on the pojo. This
> > should
> > be controlled by hibernate (with field access) completely.
> >
> > When there is no setter method for id - BeanForm is returning a
> Group
> > object with a null "value" for id. This means that what should
> > have been
> > an update in the database becomes an insert since hibernate thinks
> > that
> > it is an not-persisted object (no id).
> >
> > Why cant the BeanForm component just update the fields in action
> > (in the
> > form) for the pojo e.g . just call setName and setDecription and
> leave
> > the id intact?
> >
> > Regards Claus
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > <ma...@tapestry.apache.org>
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > <ma...@tapestry.apache.org>
> >
> >
>
>
Re: BeanForm and no setter method for persistence id
Posted by Claus Myglegaard Vagner <cv...@nordija.com>.
Hi Daniel,
You are quite right! No problem with BeanForm component. The problem
were somewhere else in the code...
Claus
D&J Gredler skrev:
> Are you listing the properties explicitly, i.e.
> properties="name,description"? If that's the case, I don't see how the
> BeanForm knows anything at all about your ID field. And if there's not
> even a setId( ) method, there's no way at all for BeanForm to modify
> the property (it doesn't modify fields directly). Is your Group object
> marked persistent in the page specification? This sounds like a
> problem somewhere else...
>
> Keep me updated,
>
> Daniel
>
>
> On 9/21/06, *Claus Myglegaard Vagner* <cvagner@nordija.com
> <ma...@nordija.com>> wrote:
>
> Hi,
>
> Is it possible to use the BeanForm component
> ( http://beanform.sourceforge.net/) for updating a pojo with no setter
> method for a persistence id?
>
> For example I have a Group object with properties id, name,
> description.
> In the form only name and description is shown. I don't want to
> show the
> id and I don't want to have a setId(id) method on the pojo. This
> should
> be controlled by hibernate (with field access) completely.
>
> When there is no setter method for id - BeanForm is returning a Group
> object with a null "value" for id. This means that what should
> have been
> an update in the database becomes an insert since hibernate thinks
> that
> it is an not-persisted object (no id).
>
> Why cant the BeanForm component just update the fields in action
> (in the
> form) for the pojo e.g . just call setName and setDecription and leave
> the id intact?
>
> Regards Claus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> <ma...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
> <ma...@tapestry.apache.org>
>
>
Re: BeanForm and no setter method for persistence id
Posted by D&J Gredler <dj...@gmail.com>.
Are you listing the properties explicitly, i.e.
properties="name,description"? If that's the case, I don't see how the
BeanForm knows anything at all about your ID field. And if there's not even
a setId( ) method, there's no way at all for BeanForm to modify the property
(it doesn't modify fields directly). Is your Group object marked persistent
in the page specification? This sounds like a problem somewhere else...
Keep me updated,
Daniel
On 9/21/06, Claus Myglegaard Vagner <cv...@nordija.com> wrote:
>
> Hi,
>
> Is it possible to use the BeanForm component
> (http://beanform.sourceforge.net/) for updating a pojo with no setter
> method for a persistence id?
>
> For example I have a Group object with properties id, name, description.
> In the form only name and description is shown. I don't want to show the
> id and I don't want to have a setId(id) method on the pojo. This should
> be controlled by hibernate (with field access) completely.
>
> When there is no setter method for id - BeanForm is returning a Group
> object with a null "value" for id. This means that what should have been
> an update in the database becomes an insert since hibernate thinks that
> it is an not-persisted object (no id).
>
> Why cant the BeanForm component just update the fields in action (in the
> form) for the pojo e.g. just call setName and setDecription and leave
> the id intact?
>
> Regards Claus
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>