@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 @Entitys and their respective @RepositoryRestResources. 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"












share|improve this question























  • 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














up vote
0
down vote

favorite












This is a spring-boot application and I've got couple of @Entitys and their respective @RepositoryRestResources. 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"












share|improve this question























  • 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












up vote
0
down vote

favorite









up vote
0
down vote

favorite











This is a spring-boot application and I've got couple of @Entitys and their respective @RepositoryRestResources. 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"












share|improve this question















This is a spring-boot application and I've got couple of @Entitys and their respective @RepositoryRestResources. 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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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
















  • 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












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"







share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    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

























    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"







    share|improve this answer


























      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"







      share|improve this answer
























        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"







        share|improve this answer














        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"








        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 11 at 22:15

























        answered Nov 11 at 6:41









        Jonathan Johx

        1154




        1154



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            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





















































            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







            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

            Museum of Modern and Contemporary Art of Trento and Rovereto