Mapping result of a native SQL query to Grails domain class

后端 未结 3 1704
长情又很酷
长情又很酷 2020-12-14 09:46

Is it possible to map the result of a native SQL query to a collection of Grails domain class instances?

3条回答
  •  一向
    一向 (楼主)
    2020-12-14 10:06

    You could map it yourself without too much trouble. Alternatively if using HQL, you could use select new map() and then take query.list().collect { new MyDomainObject(it) } to bind the parameters by hand.

提交回复
热议问题