@RepositoryRestResource entity fields null during add new entity with curl POST
up vote
0
down vote
favorite
This is a spring-boot application and I've got couple of @Entity
s and their respective @RepositoryRestResource
s. App
is parent and History
is child in the DB. When I'm trying to add new record to History (using POST), I can't figure out why version
and tag
are null in the response.
These fields are null
in DB too. Debugging realized the request is not deserialized properly. Anyone seen this issue before?
Suspecting this fix to be the cause, can't really confirm because downgrading the jackson version didn't help. Full application is here.
$ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag:"tagtest1"' -H "Content-Type: application/json" -X POST http://localhost:8080/repo/history
Response :
"version" : null,
"tag" : null,
"_links" :
"self" :
"href" : "http://localhost:8080/repo/history/1"
,
"history" :
"href" : "http://localhost:8080/repo/history/1"
,
"app" :
"href" : "http://localhost:8080/repo/history/1/app"
java spring spring-boot spring-data-jpa spring-data
add a comment |
up vote
0
down vote
favorite
This is a spring-boot application and I've got couple of @Entity
s and their respective @RepositoryRestResource
s. App
is parent and History
is child in the DB. When I'm trying to add new record to History (using POST), I can't figure out why version
and tag
are null in the response.
These fields are null
in DB too. Debugging realized the request is not deserialized properly. Anyone seen this issue before?
Suspecting this fix to be the cause, can't really confirm because downgrading the jackson version didn't help. Full application is here.
$ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag:"tagtest1"' -H "Content-Type: application/json" -X POST http://localhost:8080/repo/history
Response :
"version" : null,
"tag" : null,
"_links" :
"self" :
"href" : "http://localhost:8080/repo/history/1"
,
"history" :
"href" : "http://localhost:8080/repo/history/1"
,
"app" :
"href" : "http://localhost:8080/repo/history/1/app"
java spring spring-boot spring-data-jpa spring-data
I think that it's missing close brackets on curl command: $ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag" :"tagtest"' -H "Content-Type: application/json" -X POST localhost:8080/repo/history
– Jonathan Johx
Nov 10 at 22:44
that's just a typo, issue exists with the close } braces also
– Anand Rockzz
Nov 10 at 22:51
1
OK let me check your repo, I'm just looking from my phone.. :)
– Jonathan Johx
Nov 10 at 22:53
Could you add in @RepositoryRestResources(collectionResourceRel = "app",...)
– Jonathan Johx
Nov 10 at 23:37
collectionResourceRel
didn't help..
– Anand Rockzz
Nov 11 at 0:53
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This is a spring-boot application and I've got couple of @Entity
s and their respective @RepositoryRestResource
s. App
is parent and History
is child in the DB. When I'm trying to add new record to History (using POST), I can't figure out why version
and tag
are null in the response.
These fields are null
in DB too. Debugging realized the request is not deserialized properly. Anyone seen this issue before?
Suspecting this fix to be the cause, can't really confirm because downgrading the jackson version didn't help. Full application is here.
$ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag:"tagtest1"' -H "Content-Type: application/json" -X POST http://localhost:8080/repo/history
Response :
"version" : null,
"tag" : null,
"_links" :
"self" :
"href" : "http://localhost:8080/repo/history/1"
,
"history" :
"href" : "http://localhost:8080/repo/history/1"
,
"app" :
"href" : "http://localhost:8080/repo/history/1/app"
java spring spring-boot spring-data-jpa spring-data
This is a spring-boot application and I've got couple of @Entity
s and their respective @RepositoryRestResource
s. App
is parent and History
is child in the DB. When I'm trying to add new record to History (using POST), I can't figure out why version
and tag
are null in the response.
These fields are null
in DB too. Debugging realized the request is not deserialized properly. Anyone seen this issue before?
Suspecting this fix to be the cause, can't really confirm because downgrading the jackson version didn't help. Full application is here.
$ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag:"tagtest1"' -H "Content-Type: application/json" -X POST http://localhost:8080/repo/history
Response :
"version" : null,
"tag" : null,
"_links" :
"self" :
"href" : "http://localhost:8080/repo/history/1"
,
"history" :
"href" : "http://localhost:8080/repo/history/1"
,
"app" :
"href" : "http://localhost:8080/repo/history/1/app"
java spring spring-boot spring-data-jpa spring-data
java spring spring-boot spring-data-jpa spring-data
edited Nov 10 at 22:51
asked Nov 10 at 16:11
Anand Rockzz
1,91922642
1,91922642
I think that it's missing close brackets on curl command: $ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag" :"tagtest"' -H "Content-Type: application/json" -X POST localhost:8080/repo/history
– Jonathan Johx
Nov 10 at 22:44
that's just a typo, issue exists with the close } braces also
– Anand Rockzz
Nov 10 at 22:51
1
OK let me check your repo, I'm just looking from my phone.. :)
– Jonathan Johx
Nov 10 at 22:53
Could you add in @RepositoryRestResources(collectionResourceRel = "app",...)
– Jonathan Johx
Nov 10 at 23:37
collectionResourceRel
didn't help..
– Anand Rockzz
Nov 11 at 0:53
add a comment |
I think that it's missing close brackets on curl command: $ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag" :"tagtest"' -H "Content-Type: application/json" -X POST localhost:8080/repo/history
– Jonathan Johx
Nov 10 at 22:44
that's just a typo, issue exists with the close } braces also
– Anand Rockzz
Nov 10 at 22:51
1
OK let me check your repo, I'm just looking from my phone.. :)
– Jonathan Johx
Nov 10 at 22:53
Could you add in @RepositoryRestResources(collectionResourceRel = "app",...)
– Jonathan Johx
Nov 10 at 23:37
collectionResourceRel
didn't help..
– Anand Rockzz
Nov 11 at 0:53
I think that it's missing close brackets on curl command: $ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag" :"tagtest"' -H "Content-Type: application/json" -X POST localhost:8080/repo/history
– Jonathan Johx
Nov 10 at 22:44
I think that it's missing close brackets on curl command: $ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag" :"tagtest"' -H "Content-Type: application/json" -X POST localhost:8080/repo/history
– Jonathan Johx
Nov 10 at 22:44
that's just a typo, issue exists with the close } braces also
– Anand Rockzz
Nov 10 at 22:51
that's just a typo, issue exists with the close } braces also
– Anand Rockzz
Nov 10 at 22:51
1
1
OK let me check your repo, I'm just looking from my phone.. :)
– Jonathan Johx
Nov 10 at 22:53
OK let me check your repo, I'm just looking from my phone.. :)
– Jonathan Johx
Nov 10 at 22:53
Could you add in @RepositoryRestResources(collectionResourceRel = "app",...)
– Jonathan Johx
Nov 10 at 23:37
Could you add in @RepositoryRestResources(collectionResourceRel = "app",...)
– Jonathan Johx
Nov 10 at 23:37
collectionResourceRel
didn't help..– Anand Rockzz
Nov 11 at 0:53
collectionResourceRel
didn't help..– Anand Rockzz
Nov 11 at 0:53
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I cloned your repository, and it's working but a couple of things, I'm not sure how you can send directly ManyToOne Object because that is the mistake in order to map it. because if you send the below body, it will be mapped version and tag but the app JSON object no, so you have to research about how to pass a JSON Object with realtionship Many to one. You need to take a look this answer Save child objects automatically using JPA Hibernate
"version":"v13",
"tag":"tagtest1",
"app":
"appId": 1,
"name":"test112"
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I cloned your repository, and it's working but a couple of things, I'm not sure how you can send directly ManyToOne Object because that is the mistake in order to map it. because if you send the below body, it will be mapped version and tag but the app JSON object no, so you have to research about how to pass a JSON Object with realtionship Many to one. You need to take a look this answer Save child objects automatically using JPA Hibernate
"version":"v13",
"tag":"tagtest1",
"app":
"appId": 1,
"name":"test112"
add a comment |
up vote
0
down vote
I cloned your repository, and it's working but a couple of things, I'm not sure how you can send directly ManyToOne Object because that is the mistake in order to map it. because if you send the below body, it will be mapped version and tag but the app JSON object no, so you have to research about how to pass a JSON Object with realtionship Many to one. You need to take a look this answer Save child objects automatically using JPA Hibernate
"version":"v13",
"tag":"tagtest1",
"app":
"appId": 1,
"name":"test112"
add a comment |
up vote
0
down vote
up vote
0
down vote
I cloned your repository, and it's working but a couple of things, I'm not sure how you can send directly ManyToOne Object because that is the mistake in order to map it. because if you send the below body, it will be mapped version and tag but the app JSON object no, so you have to research about how to pass a JSON Object with realtionship Many to one. You need to take a look this answer Save child objects automatically using JPA Hibernate
"version":"v13",
"tag":"tagtest1",
"app":
"appId": 1,
"name":"test112"
I cloned your repository, and it's working but a couple of things, I'm not sure how you can send directly ManyToOne Object because that is the mistake in order to map it. because if you send the below body, it will be mapped version and tag but the app JSON object no, so you have to research about how to pass a JSON Object with realtionship Many to one. You need to take a look this answer Save child objects automatically using JPA Hibernate
"version":"v13",
"tag":"tagtest1",
"app":
"appId": 1,
"name":"test112"
edited Nov 11 at 22:15
answered Nov 11 at 6:41
Jonathan Johx
1154
1154
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53240831%2frepositoryrestresource-entity-fields-null-during-add-new-entity-with-curl-post%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think that it's missing close brackets on curl command: $ curl -d '"app":"appId":1,"name":"test2","version":"v13","tag" :"tagtest"' -H "Content-Type: application/json" -X POST localhost:8080/repo/history
– Jonathan Johx
Nov 10 at 22:44
that's just a typo, issue exists with the close } braces also
– Anand Rockzz
Nov 10 at 22:51
1
OK let me check your repo, I'm just looking from my phone.. :)
– Jonathan Johx
Nov 10 at 22:53
Could you add in @RepositoryRestResources(collectionResourceRel = "app",...)
– Jonathan Johx
Nov 10 at 23:37
collectionResourceRel
didn't help..– Anand Rockzz
Nov 11 at 0:53