• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

How to use curl to add to a one-to-many or many-to-many relationship?

Ranch Hand
Posts: 422
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have modified a little derby JPA example I found in the maven archetypes.
This example uses JPA to define a many-to-many relationship between employee objects and department objects.
My Spring Boot Groovy implementation below works with curl for POST and GET. Hurry!

I start by adding a few employees

Now I view the results with a GET

This produces this JSON

Notice that my department is null!

How do I use curl to add a new employee object that has the same department "java" as Jakab and Captain Nemo?


    Bookmark Topic Watch Topic
  • New Topic