[英]hibernate native query mapping
I am trying to make a native named query.I saw the link 我正在尝试进行本地命名查询。我看到了链接
result-set-mapping-complex-mappings 结果集映射复杂映射
<sql-result-set-mapping name="BookAuthorMappingXml">
<entity-result entity-class="org.thoughts.on.java.jpa.model.Author">
<field-result name="id" column="authorId"/>
<field-result name="firstName" column="firstName"/>
<field-result name="lastName" column="lastName"/>
<field-result name="version" column="authorVersion"/>
</entity-result>
<entity-result entity-class="org.thoughts.on.java.jpa.model.Book">
<field-result name="id" column="id"/>
<field-result name="title" column="title"/>
<field-result name="author" column="author_id"/>
<field-result name="version" column="version"/>
</entity-result>
</sql-result-set-mapping>
the number of columns i have is more than 20.Is there is way to map all columns in one go 我拥有的列数超过20。是否有一种方法可以一次性映射所有列
I am using hibernate 4.2 我正在使用休眠4.2
What you need is an hibernate mapping auto generation. 您需要的是自动生成休眠映射。 You can follow the blog from mkyong
您可以关注mkyong的博客
https://www.mkyong.com/hibernate/how-to-generate-code-with-hibernate-tools/ https://www.mkyong.com/hibernate/how-to-generate-code-with-hibernate-tools/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.