How to persist a Map<String, List<Object>> in Hibernate

…衆ロ難τιáo~ 提交于 2019-12-05 20:04:30

The objects stored in the map must be the target object of the oneToMany association (always mapped). You can't store arbitrary objects or collections there.

Personally, I don't think this is a good use of Hibernate. There's no abstraction here. It would make sense if you had a model object with a one-to-many relation expressed as a child List as a data member in the parent.

My advice? Don't use Hibernate. Use straight JDBC, Spring's JDBC template, or something like iBatis.

ORM stands for "Object Relational Mapping". You have tables, so you've got the relational part. You've got data that you can assign to columns in tables.

But it sounds to me like you've got no Objects. So why use Hibernate?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!