Programming Tutorials

(追記) (追記ここまで)

Fields in JasperReports

By: MakeItSimple. in Java Tutorials on 2008年09月02日 [フレーム]

Report fields represent the only way to map data from the data source into the report generating routines. When the data source of the report is a ResultSet, all fields must map to corresponding columns in the ResultSet object. That is, they must have the same name as the columns they map and a compatible type.

For example:

If we want to generate a report using data retrieved from the table Employees, which has the following structure:

Column NameDatatypeLength
--------------------------------------EmployeeIDint4LastNamevarchar20FirstNamevarchar10HireDatedatetime8

we can define the following fields in our report design:

<field name="EmployeeID" class="java.lang.Integer"/>
<field name="LastName" class="java.lang.String"/><field name="FirstName" class="java.lang.String"/><field name="HireDate" class="java.util.Date"/>

If we declare a field that does not have a corresponding column in the ResultSet, an exception will be thrown at runtime. Columns present in the ResultSet object that do not have corresponding fields in the report design do not affect the report filling operations, but they also wont be accessible.




(追記) (追記ここまで)


Add Comment

JavaScript must be enabled for certain features to work
* Required information
1000

Comments

No comments yet. Be the first!
(追記) (追記ここまで)
(追記) (追記ここまで)

AltStyle によって変換されたページ (->オリジナル) /