Ruby DataMapper:是否有与 Java Hibernate 相当的工具?组件映射?
来自 Java/Hibernate 环境,我可以将表中的某些列映射为属于父类的“组件”。例如,一个 User 对象包含一个 Preference 对象,该对象实际上将所有属性映射到数据库中的一张表中。
DataMapper中有类似的东西吗?或者其他数据库接口库?
Coming from a Java/Hibernate environment, I can map some columns within a table to be a "component" that is belongs to a parent class. For example an User object contains a Preference object, which actually mapped all the attributes into one table in the database.
Is there anything similar in DataMapper? or other database interfacing library?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DataMapper 目前不支持此功能,但它已在路线图上并被称为“嵌入值”。 ActiveRecord 已经支持定义嵌入值。
只要 DataMapper 没有对嵌入值的内置支持,就可以按照 https:/ 中概述的模式“伪造”它们/gist.github.com/873428
DataMapper currently doesn't support this feature, but it's on the roadmap and is referred to as "embedded value". ActiveRecord supports defining embedded values already.
As long as DataMapper has no builtin support for embedded values, they can be "faked" by following the pattern outlined in https://gist.github.com/873428