S
S
Sergey Shlensky2022-02-17 10:42:55
Java
Sergey Shlensky, 2022-02-17 10:42:55

Java Spring Boot MVC how to display category hierarchy using JPA?

I have two tables, a category and a subcategory, with a ManytoOne relationship between them (one category can have many subcategories, but a subcategory has only one category) . You
can see the table structure here

. I need to display the subcategory category hierarchy on the page using the FreeMarker templating engine.
Hierarchy example:

  • category 1
    • subcategory 1
    • subcategory 3

  • category 2
    • subcategory 2
    • subcategory 4



How to implement this using Java Spring Boot JPA? If this is not possible to do with Java Spring Boot JPA, then how can this be done and output to the FreeaMarker template?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question