Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting values on a object based on returning query [Solved]

 
Oddbjorn Lona
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a query, similar to this:



This basically is returning a list of values from the tablename.

Now, field4 and field5 are underlying objects.

Now, the thing is i cannot use tablename domain directly, so i (think) i need to build this up manually, so what i have is a loop :



How do I populate the values for foo now? I only require a few values, to make a list.

Thanks

 
Oddbjorn Lona
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found the answer, which is somewhat of a hack, i admit it:

the return getSession().createQuery(sql.toString()).list() turns out to be a Query.

Then traversing through the query like this, and populating my object.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic