-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: Probleme saving actionFormBean
PostPosted: Thu Jul 15, 2004 6:46 am 
Newbie

Joined: Wed Mar 17, 2004 10:14 am
Posts: 14
Location: France
Posted: Thu Jul 15, 2004 10:57 am Post subject: net.sf.hibernate.id.IdentifierGenerationException

I use struts to get a actionFormBean from an Html Formular, and when i try to save this bean using sess.save(actionFormBean); I get an exception
net.sf.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save()
I store all of fields(whith identifers) in this html fomular, so i thinks that they are assigned manually .
Thinks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 15, 2004 6:53 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
I still remember one of the advices about Struts form beans :):
Form Bean - is a View Object, don't use it for transferring data or as Business Entity.

And I guess you are using "assigned" key generator, that means that you have to generate ID and set it manually.

http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-id-assigned
assigned
lets the application to assign an identifier to the object before save() is called.

--
Leonid


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 15, 2004 6:57 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
That is Form Bean is a "V" in MVC, but not an "M".....


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 15, 2004 7:03 am 
Newbie

Joined: Wed Mar 17, 2004 10:14 am
Posts: 14
Location: France
Is there any solution to store Data from the ActionFormBean to an HibernateBean or i should di it field per field?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 15, 2004 7:27 am 
Expert
Expert

Joined: Fri Feb 06, 2004 7:49 am
Posts: 255
Location: Moscow, Russia
You can use Jakarta Commons Bean Utils http://jakarta.apache.org/commons/beanutils/

BeanUtils.copyProperties
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/BeanUtils.html#copyProperties(java.lang.Object,%20java.lang.Object)
or
PropertyUtils.copyProperties
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/PropertyUtils.html#copyProperties(java.lang.Object,%20java.lang.Object)

--
Leonid


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 15, 2004 7:34 am 
Newbie

Joined: Wed Mar 17, 2004 10:14 am
Posts: 14
Location: France
ok thinks a lot


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.