yes, it was the problem, I have solved it! thanks


Nils-Helge Garli wrote:
> 
> Assuming you're using Hibernate or something, the save method probably
> returns the generated identity of the stored object instance. So my
> guess is that you're getting the id of the user returned, which is a
> Long, and not a User object.
> 
> Nils-H
> 
> On 11/16/07, slideharmony <[EMAIL PROTECTED]> wrote:
>>
>> this line:
>> newuser = (User)getSession().save(user);
>>
>>
>>
>> Hernandez, David wrote:
>> >
>> >
>> > What line's the Exception being thrown on?
>> >
>> > -----Original Message-----
>> > From: slideharmony [mailto:[EMAIL PROTECTED]
>> > Sent: Friday, November 16, 2007 9:35 AM
>> > To: user@struts.apache.org
>> > Subject: ClassCastException
>> >
>> >
>> > Hello,
>> > I have a problem saving a bean User. I use the following code:
>> >
>> > UserDao dao = new UserDao();
>> > User user = new User();
>> > Service.populate(user);
>> > dao.save(utente);
>> > if(user != null){
>> > return SUCCESS;
>> > }
>> >
>> > here is the dao.save method:
>> >
>> >
>> > public User save(User user){
>> > Utente newuser = null;
>> > begin();
>> > newuser = (User)getSession().save(user); commit(); close(); return
>> > newuser; }
>> >
>> > this code throws a ClassCastException: java.lang.Long I have mapped all
>> > correctly, i have the same code that works perfectly in struts, but I
>> > get that exception with struts2. Can anybody help me?
>> > --
>> > View this message in context:
>> > http://www.nabble.com/ClassCastException-tf4821639.html#a13794339
>> > Sent from the Struts - User mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> -
>> > - - - - - - -
>> >
>> > This message is intended only for the personal and confidential use of
>> the
>> > designated recipient(s) named above.  If you are not the intended
>> > recipient of this message you are hereby notified that any review,
>> > dissemination, distribution or copying of this message is strictly
>> > prohibited.  This communication is for information purposes only and
>> > should not be regarded as an offer to sell or as a solicitation of an
>> > offer to buy any financial product, an official confirmation of any
>> > transaction, or as an official statement of Lehman Brothers.  Email
>> > transmission cannot be guaranteed to be secure or error-free. 
>> Therefore,
>> > we do not represent that this information is complete or accurate and
>> it
>> > should not be relied upon as such.  All information is subject to
>> change
>> > without notice.
>> >
>> > --------
>> > IRS Circular 230 Disclosure:
>> > Please be advised that any discussion of U.S. tax matters contained
>> within
>> > this communication (including any attachments) is not intended or
>> written
>> > to be used and cannot be used for the purpose of (i) avoiding U.S. tax
>> > related penalties or (ii) promoting, marketing or recommending to
>> another
>> > party any transaction or matter addressed herein.
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/ClassCastException-tf4821639.html#a13794434
>> Sent from the Struts - 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/ClassCastException-tf4821639.html#a13795487
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to