Java Reference
In-Depth Information
<textFieldExpression>
<![CDATA[$F{id}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement width="100" height="30" x="100" y="0"/>
<textFieldExpression>
<![CDATA[$F{aircraftSerial}]]>
</textFieldExpression>
</textField>
<textField>
<reportElement width="100" height="30" x="200" y="0"/>
<textFieldExpression>
<![CDATA[$F{yearBuilt}]]>
</textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
This JRXML template does not look much different from other JRXML templates we
have seen before. The only difference is that its embedded report query is written
in HQL. To let JasperReports know that it should interpret the query as HQL
(as opposed to SQL), the language attribute of the <queryString> element must
be set to hql .
There is nothing special we need to do to compile a report using HQL as its query
language. We can use standard ANT tasks or compile it programmatically, just like
any other JRXML template.
The HQL query in this template retrieves data in the aircraft table for all aircraft
registered in the country specified by the countryCode parameter. Hibernate uses
Value Objects that map to database tables. In order for the HQL query in the JRXML
template to work, we need to create a Value Object that maps to the aircraft table.
To develop the example for this section, we used an
Eclipse plug-in called Hibernate Synchronizer . Hibernate
Synchronizer generates Hibernate Java source code and
XML configuration from the database schema. It greatly
speeds up development of the Data Access Layer of an
application using Hibernate for database access.
Hibernate Synchronizer can be downloaded from
http://hibernatesynch.sourceforge.net .
 
Search WWH ::




Custom Search