Create 3 entities separately for country,state, district and create association between them.
Country can have multiple states – 1-*
State can have multiple districts – 1-*
In my case, I am trying to add vehicle details. So I have my vehicle entity which is mapped with country, state and district entities. Multiple vehicle can be mapped with multiple countries, multiple states, multiple districts just for example.
When you generate overview page for vehicle entity you will get fields for your attributes and reference selector for your associations.
In those reference selector make use constrained by option to filter state based on country selection and district based on state selection. Please find the attached screenshots.
State Reference selector constraint condition:
District constrained by condition:
This would be the domain model for it:
On the page you want to add three ReferenceSelectors to select a country, then a state, then a district. Have State editable only if Country has a value, and District only editable if State has a value.
As DataSource to each of the three ReferenceSelectors, add their entity. For State and District: limit the list depending on the value of Country, resp. State.