寻找使用休眠存储嵌套数据的有效方法
我一直在尝试找到一种有效的方法来表示 java/hibernate 中的嵌套数据。我最初的解决方案是使用自引用连接的父/子列表,但在 SQL 中构建报告时,这种技术存在明显的缺陷。我正在研究嵌套集和物化路径,但我希望有一种方法可以表示 hibernate 原生的嵌套数据,并且可以通过 SQL 进行高效查询。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您可以将嵌套数据采用继承层次结构的形式,那么您可以查看 Hibernate 的继承映射策略。我已经使用过它们,如果配置得当,那么它们是相当不错的。
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.