1 5 6 @javax.persistence.NamedQuery(name="plane.getAll", queryString="select p from Plane p") 7 @NamedNativeQueries( { 8 @javax.persistence.NamedNativeQuery( 9 name="night.getAll.bySQL", 10 queryString="select id, night_duration, night_date as dte, area_id from Night where night_duration > ?", 11 resultSetMapping = "sqlmapping") 12 } 13 ) 14 @NamedNativeQuery(name="getAreaByNative", queryString = "select * from Area", resultClass = Area.class) 15 @SqlResultSetMapping( 16 name="sqlmapping", 17 entities = { 18 @EntityResult( 19 name="org.hibernate.test.annotations.query.Night", 20 fields = { 21 @FieldResult(name="id", column = "id"), 22 @FieldResult(name="duration", column = "night_duration"), 23 @FieldResult(name="date", column = "dte"), 24 @FieldResult(name="area", column = "area_id") 25 } 26 ) 27 } 28 ) 29 package org.hibernate.test.annotations.query; 30 31 import javax.persistence.EntityResult; 32 import javax.persistence.FieldResult; 33 import javax.persistence.NamedNativeQueries; 34 import javax.persistence.NamedNativeQuery; 35 import javax.persistence.SqlResultSetMapping; 36 | Popular Tags |