How can I design Jhipster JDL relationship for a simple Region > Country > State > City dropdowns












0















I couldn't figure out how to make relations between entities make them depended each other.
Is jdl itself enough to have entities like below;




  • Add New Region:


    • Region Name



  • Add New Country:


    • Region (Dropdown)

    • Country Name



  • Add New State:


    • Region (Dropdown)

    • Country (Dropdown "List updates with the change of the region)

    • State Name



  • Add New City:


    • Region (Dropdown)

    • Country (Dropdown "List updates with the change of the region)

    • State (Dropdown "List updates with the change of the Country)

    • City Name



  • Add New Address:


    • Region (Dropdown)

    • Country (Dropdown "List updates with the change of the region)

    • State (Dropdown "List updates with the change of the Country)

    • City (Dropdown "List updates with the change of the State)

    • Address




I've tried this;



entity Region {
regionName String required
}

entity Country {
countryName String required
}

entity State {
stateName String required
}

entity City {
cityName String required
}

entity Address {
addressLine String required
}

relationship ManyToOne {
Country{region(regionName)} to Region,
State{country(countryName)} to Country,
City{state(stateName)} to State,
Address{city(cityName)} to City
}

paginate all with infinite-scroll
service all with serviceImpl


This jdl shows only it's parent. I want to create a new address entity with all parents up to region.



If I try to make relationships with all parents, all dropdowns are individual. You can select Asia > USA > Paris.



What is the right way to relate the address with Region, Country, State, City with correct dependencies?










share|improve this question





























    0















    I couldn't figure out how to make relations between entities make them depended each other.
    Is jdl itself enough to have entities like below;




    • Add New Region:


      • Region Name



    • Add New Country:


      • Region (Dropdown)

      • Country Name



    • Add New State:


      • Region (Dropdown)

      • Country (Dropdown "List updates with the change of the region)

      • State Name



    • Add New City:


      • Region (Dropdown)

      • Country (Dropdown "List updates with the change of the region)

      • State (Dropdown "List updates with the change of the Country)

      • City Name



    • Add New Address:


      • Region (Dropdown)

      • Country (Dropdown "List updates with the change of the region)

      • State (Dropdown "List updates with the change of the Country)

      • City (Dropdown "List updates with the change of the State)

      • Address




    I've tried this;



    entity Region {
    regionName String required
    }

    entity Country {
    countryName String required
    }

    entity State {
    stateName String required
    }

    entity City {
    cityName String required
    }

    entity Address {
    addressLine String required
    }

    relationship ManyToOne {
    Country{region(regionName)} to Region,
    State{country(countryName)} to Country,
    City{state(stateName)} to State,
    Address{city(cityName)} to City
    }

    paginate all with infinite-scroll
    service all with serviceImpl


    This jdl shows only it's parent. I want to create a new address entity with all parents up to region.



    If I try to make relationships with all parents, all dropdowns are individual. You can select Asia > USA > Paris.



    What is the right way to relate the address with Region, Country, State, City with correct dependencies?










    share|improve this question



























      0












      0








      0








      I couldn't figure out how to make relations between entities make them depended each other.
      Is jdl itself enough to have entities like below;




      • Add New Region:


        • Region Name



      • Add New Country:


        • Region (Dropdown)

        • Country Name



      • Add New State:


        • Region (Dropdown)

        • Country (Dropdown "List updates with the change of the region)

        • State Name



      • Add New City:


        • Region (Dropdown)

        • Country (Dropdown "List updates with the change of the region)

        • State (Dropdown "List updates with the change of the Country)

        • City Name



      • Add New Address:


        • Region (Dropdown)

        • Country (Dropdown "List updates with the change of the region)

        • State (Dropdown "List updates with the change of the Country)

        • City (Dropdown "List updates with the change of the State)

        • Address




      I've tried this;



      entity Region {
      regionName String required
      }

      entity Country {
      countryName String required
      }

      entity State {
      stateName String required
      }

      entity City {
      cityName String required
      }

      entity Address {
      addressLine String required
      }

      relationship ManyToOne {
      Country{region(regionName)} to Region,
      State{country(countryName)} to Country,
      City{state(stateName)} to State,
      Address{city(cityName)} to City
      }

      paginate all with infinite-scroll
      service all with serviceImpl


      This jdl shows only it's parent. I want to create a new address entity with all parents up to region.



      If I try to make relationships with all parents, all dropdowns are individual. You can select Asia > USA > Paris.



      What is the right way to relate the address with Region, Country, State, City with correct dependencies?










      share|improve this question
















      I couldn't figure out how to make relations between entities make them depended each other.
      Is jdl itself enough to have entities like below;




      • Add New Region:


        • Region Name



      • Add New Country:


        • Region (Dropdown)

        • Country Name



      • Add New State:


        • Region (Dropdown)

        • Country (Dropdown "List updates with the change of the region)

        • State Name



      • Add New City:


        • Region (Dropdown)

        • Country (Dropdown "List updates with the change of the region)

        • State (Dropdown "List updates with the change of the Country)

        • City Name



      • Add New Address:


        • Region (Dropdown)

        • Country (Dropdown "List updates with the change of the region)

        • State (Dropdown "List updates with the change of the Country)

        • City (Dropdown "List updates with the change of the State)

        • Address




      I've tried this;



      entity Region {
      regionName String required
      }

      entity Country {
      countryName String required
      }

      entity State {
      stateName String required
      }

      entity City {
      cityName String required
      }

      entity Address {
      addressLine String required
      }

      relationship ManyToOne {
      Country{region(regionName)} to Region,
      State{country(countryName)} to Country,
      City{state(stateName)} to State,
      Address{city(cityName)} to City
      }

      paginate all with infinite-scroll
      service all with serviceImpl


      This jdl shows only it's parent. I want to create a new address entity with all parents up to region.



      If I try to make relationships with all parents, all dropdowns are individual. You can select Asia > USA > Paris.



      What is the right way to relate the address with Region, Country, State, City with correct dependencies?







      jhipster jdl






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 7 '18 at 6:42









      Spara

      3,08721441




      3,08721441










      asked Nov 14 '18 at 20:38









      Serhat TürkmanSerhat Türkman

      999




      999
























          1 Answer
          1






          active

          oldest

          votes


















          1














          The JDL looks good to me, it's just that JHipster won't generate the client view with transitive relationships. You have to write it manually.



          On server side, you can use DTOs to combine all data in one request. Add dto * with mapstruct to the bottom of your JDL and then edit generated mappers.






          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',
            autoActivateHeartbeat: false,
            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%2f53308386%2fhow-can-i-design-jhipster-jdl-relationship-for-a-simple-region-country-state%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









            1














            The JDL looks good to me, it's just that JHipster won't generate the client view with transitive relationships. You have to write it manually.



            On server side, you can use DTOs to combine all data in one request. Add dto * with mapstruct to the bottom of your JDL and then edit generated mappers.






            share|improve this answer




























              1














              The JDL looks good to me, it's just that JHipster won't generate the client view with transitive relationships. You have to write it manually.



              On server side, you can use DTOs to combine all data in one request. Add dto * with mapstruct to the bottom of your JDL and then edit generated mappers.






              share|improve this answer


























                1












                1








                1







                The JDL looks good to me, it's just that JHipster won't generate the client view with transitive relationships. You have to write it manually.



                On server side, you can use DTOs to combine all data in one request. Add dto * with mapstruct to the bottom of your JDL and then edit generated mappers.






                share|improve this answer













                The JDL looks good to me, it's just that JHipster won't generate the client view with transitive relationships. You have to write it manually.



                On server side, you can use DTOs to combine all data in one request. Add dto * with mapstruct to the bottom of your JDL and then edit generated mappers.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 14 '18 at 22:50









                Gaël MarziouGaël Marziou

                10k22533




                10k22533
































                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53308386%2fhow-can-i-design-jhipster-jdl-relationship-for-a-simple-region-country-state%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







                    Popular posts from this blog

                    Florida Star v. B. J. F.

                    Error while running script in elastic search , gateway timeout

                    Adding quotations to stringified JSON object values