The setId() method shouldn't be called when you save a form. Instead,
the object.setId() method should be called. setId() is only called
when you edit and pass in id=foo.

Matt

On Fri, Jan 9, 2009 at 3:15 AM, sudhakargupta
<[email protected]> wrote:
>
>     I created the code with the appfuse:gen but in the action class one
> method called prepare() at the time of save then it is searching for the
> given id value in the form page and it throws an exception in the
> daoHibernate class.
>
>    so, i change the code in prepare method like the below
>
>   public void prepare() {
>            if (!"".equals(getRequest().getParameter("xxx.id"))) {
>                xxx =
> xxxManager.getXxx(getRequest().getParameter("xxx.id"));
>            } else {
>                xxx = new Xxx();
>            }
>        }
>    }
>    then it inserts the record but, in the next time i created with the same
> id then it's not shows the duplicate error and it updates the previous
> record of that id with the given data. so, i want to assign id in the action
> class with the setId() method.
>
>   is the setId() method affects at the time of edit, please help me to
> overcome this problem..
>
> Regards,
> Sudhakar..
>
>
> mraible wrote:
>>
>> Have you tried to do this by writing code? If so, what's your code
>> look like and what errors are you experiencing?
>>
>> Matt
>>
>> On Wed, Jan 7, 2009 at 11:46 PM, sudhakargupta
>> <[email protected]> wrote:
>>>
>>> Hi..
>>>  Thanks in advance for your help..
>>>
>>>  In appfuse2-basic struts how to assign the id value of the primary key
>>> manually from the form page or in the action class.. why because my
>>> requirement is the primary key is a string value (ex: FGP-1020-501), so i
>>> need an string value for the primary key please help me for this one...
>>>
>>>
>>> Regards,
>>> Sudhakar..
>>> --
>>> View this message in context:
>>> http://www.nabble.com/how-to-assign-primarykey-value-manually-from-the-form-page-or-in-the-action-class-tp21346683s2369p21346683.html
>>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/how-to-assign-primarykey-value-manually-from-the-form-page-or-in-the-action-class-tp21346683s2369p21369575.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to