javahibernatenested-setsadjacency-listmaterialized-path-pattern

Looking for effecient way to store nested data with hibernate


I've been trying to find an efficient way to represent nested data in java/hibernate. My initial solution was a parent/child list with a self referencing join, but there are obvious pitfalls to this technique when building reports in SQL. I was looking into nested set and materialized path, but I was hoping there would be a way to represent nested data native to hibernate that is also efficient to query via SQL.


Solution

  • If you could have your nested data in the form of an inheritance hierarchy then you can have a look into the Inheritance Mapping Strategies of Hibernate. I've used them and if configured well then they are quite good.