Matching your own hibernate queries

I am trying to create a native named.I query I saw a 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 a way to match all columns in one pass

I am using hibernate 4.2

+6
source share
1 answer

What you need is the automatic generation of the sleep mode display. You can follow blogs from mkyong

https://www.mkyong.com/hibernate/how-to-generate-code-with-hibernate-tools/

+2
source

Source: https://habr.com/ru/post/1016167/


All Articles