Re: BeanForm and no setter method for persistence id
Hi Daniel, You are quite right! No problem with BeanForm component. The problem were somewhere else in the code... Claus DJ 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* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Re: BeanForm and no setter method for persistence id
Cool, thanks for the update! On 9/22/06, Claus Myglegaard Vagner [EMAIL PROTECTED] wrote: Hi Daniel, You are quite right! No problem with BeanForm component. The problem were somewhere else in the code... Claus DJ 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* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
Re: BeanForm and no setter method for persistence id
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 [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]