File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Can not save the foreign key in Spring form Select tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Can not save the foreign key in Spring form Select tag" Watch "Can not save the foreign key in Spring form Select tag" New topic
Forums: Spring Object Relational Mapping
Author

Can not save the foreign key in Spring form Select tag

Zed Ahmed
Greenhorn

Joined: Apr 29, 2010
Posts: 5
Hi All
I'm trying to save a form that has a foreign key in select tag but it's always null. When I use the inspect element it posts the selected id so I can't say it's problem with form. Can someone please help.

Form

Controller

JPA

Persistence Object

Error



Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1676
    
    7

Do you have hibernate-core jar on your classpath?


[How To Ask Questions][Read before you PM me]
Zed Ahmed
Greenhorn

Joined: Apr 29, 2010
Posts: 5
Bill Gorder wrote:Do you have hibernate-core jar on your classpath?


Many thanks for your input it helped alot.


I had these dependencies as 4.1.3. When I updated them it worked.
Thank you
Zed
Zed Ahmed
Greenhorn

Joined: Apr 29, 2010
Posts: 5
Well this has got rid of the errors but it has a strange behaviour now, it creates a new category even thou I'm in product controller and trying to save a new product with selected category(FK). Then it adds this newly created categoryId which is duplicate of the one you selected( the name, not the id) into product.categoryId.
I really hope I'm not confusing anyone. I would really appreciate some please.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can not save the foreign key in Spring form Select tag