First, let me explain my usecase. It\'s pretty straight forward. There is a User entity and a Service entity. I have ManytoMany association between User and Service using UserSe
I figured out the issue and got it working.
Previously, my request body was:
{
"paramName": "p1",
"paramValue": "v1",
"service": {
"href": "http://localhost:8080/em/api/userServices/1/service/2"
},
"user": {
"href": "http://localhost:8080/em/api/userServices/1/user/1"
}
}
I figured out that it should be the following:
{
"paramName": "p1",
"paramValue": "v1",
"service": "http://localhost:8080/em/api/services/2",
"user": "http://localhost:8080/em/api/users/1"
}
I feel there is still an issue with spring-data-rest. Kindly clarify, if anyone feels otherwise. Even with the fixed request, i was getting null constraint for ServiceId. I figured out in db, the primary key column for service was service_id. Even though, I have the entity mapping properly (My Id property in Service Entity maps properly to service_id in db), it was not working, I had to change the column name to id to get this working.
Spring-Data-Rest should depending upon the Entity mappings for Id right ? If so, then Still there is a bug.
Thanks, Vivek