• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

How to insert(save) 2 entities with Bidirectional relationship in Spring Boot Controller?

 
Ranch Hand
Posts: 519
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi experts,

I am stuck at how to handle 2 entities(models) in the Controller of a Spring Boot web app.

This is my attempt so far :



I have googled but just can't find something relevant.

Hope someone can tell me the right way to do it.

Tks.
 
Master Rancher
Posts: 451
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first of all you capitalized a variable name which is a nono. Also, you don't have to use modelAttribute. If you  just name the properties in the html form after the properties of two different models then spring will automatically make them and insert them in the method parameters.

not sure how I would do two model attributes.
 
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have answered your similar question in your another post.
Try and let us know if that works out.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!