[英]Hibernate: projection over entities
Is it possible to obtain a projected entity of an existing entity in Hibernate?是否可以在 Hibernate 中获取现有实体的投影实体? For example, I have an entity User with id, version, name, address table.
例如,我有一个带有 id、版本、名称、地址表的实体用户。 For some use cases I need all the columns, while for some other use cases I need a subset of them.
对于某些用例,我需要所有列,而对于其他一些用例,我需要其中的一个子集。 I know that it is possible to create a new entity, but I would like to know if it is possible to project it as for DTO projection for example.
我知道可以创建一个新实体,但我想知道是否可以像 DTO 投影一样对其进行投影。
Thank you谢谢
也许创建 2 个 DTO 和 2 个转换器?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.