Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Ranch Hand
Posts: 417
  • Mark post as helpful
  • send pies
  • 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?


You've gotta fight it! Don't give in! Read this tiny ad:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!