Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can not save the foreign key in Spring form Select tag

 
Zed Ahmed
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have hibernate-core jar on your classpath?
 
Zed Ahmed
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic