views:

353

answers:

1

Okay, so I've got iReport up and running, and I can now run HQL queries in it, and it will fetch back objects, and put them in the Fields section of the Report inspector.

Do I really need to flatten out all my queries so that I only return one "level" of actual data values, and not my entity objects? I'd rather like to just return the objects and have their toString() be displayed on the report or else the HQL seems to be so complex that it's stumping me.

Thanks! Joshua

+1  A: 

I think you could use the objects. For instance, if you have a field father you could use "father.getFather().getFather().getName()" to get the name of grandfather of the current line. One thing to take care is the loading type. It must be EAGER (not LAZY) otherwise the data wont be loaded apropriettaly.

EDIT: Joshua, we can put whatever java code we want inside a textField:

<textFieldExpression   class="java.lang.String"><![CDATA[$P{samples}.size() < 2 ? "" : ((br.com.laboroil.report.bean.Sample) $P{samples}.get(1)).getCode()]]></textFieldExpression>
Leonel Martins
But I still need that getName() in there to get the actual name, since I can't do getName() from in iReport, I have to do it in the hql query.I've got my data buried terribly deep in my objects...
but you can do getName().
Leonel Martins