• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Can not save the foreign key in Spring form Select tag

 
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



 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • 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.
 
I wish to win the lottery. I wish for a lovely piece of pie. And I wish for a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic