Grails using native queries,Hibernate addEntity, and a getting a map -


when map gorm entities native query results, list back, want map.

so want each row have team property(team instance) , several custom properties/columns produced query.

i map team using

lookup.addentity(t,team.class); lookup.setresulttransformer(aliastoentitymapresulttransformer.instance); return lookup.list(); 

the result list of lists.i have do...

returnedlist.each{     println it[0].id;//team instance     println it[1];//custom column } 

less read friendly next developer i'd like. there way map back? (not counting writing own list-to-map function, if there not built in solution)

found hibernat.transform.transformers class

import org.hibernate.transform.transformers ...

lookup.setresulttransformer(transformers.alias_to_entity_map) 

returns map instead of list.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo