Representing Tables in XML
In the Domain Designer, you can select only entire tables, not individual columns. In the XML design file, however, you can specify any subset of columns that you need.
• | jdbcTable – Represents a table or a copy of a table in the data source. A Domain design must reference all the tables it needs to access. The jdbcTable element is also used to describe join trees, but this case is documented separately in Representing Joins in XML. All three attributes of jdbcTable are required: |
• | datasourceId – Alias that identifies the data source. When created in the Domain Designer, this is the data source alias defined in Derived Tables Tab. When creating a design file, this alias may be any name you choose, but it must be identical for all tables and derived tables. When uploading the file, the datasourceId automatically becomes the alias associated with the data source defined for the Domain. |
• | tableName – Literal name of the table in the data source. Depending on the data source type and the database, this name may include additional information: |
• | For PostgreSQL and Oracle-based data sources, the table name includes the database schema name in the form schema.table, if you opted to include schema names when exporting the design. |
• | For PostgreSQL, Oracle, and other schema-based data sources within a virtual data source, the table name includes the data source prefix (defined when the virtual data source was created) and the database schema name in the form dataSourcePrefix_schema.table, if you opted to include schema names when exporting the design. The table name includes the data source prefix in the form dataSourcePrefix.table if you opted not to include schema names when exporting the design. |
• | For MySQL and similar data sources within a virtual domain, the table name includes the data source prefix and the database name in the form dataSourcePrefix_database.table. |
• | id – Table ID used to reference the table in the Domain design. If you copy a table to join it multiple times, each copy has the same datasourceId and tableName but must be given a different id. |
• | fieldList – A container for field elements. Required on jdbcTable elements because it would not make sense to have a table without columns in the Domain design. You must reference all the columns you use in the Domain. |
• | field – Represents a column of a table in the data source. All the columns you want to reference in the Domain defined with this element. Both attributes of field are required: |
• | id – Literal name of the column in the data source. As in the JDBC model that the data source is based on, the id must be unique within the jdbcTable, but not necessarily within the Domain. |
• | type – The Java type of the column, as determined from the data source by the JDBC driver. The available types are shown in the following table. |
java.lang.Boolean java.lang.Byte java.lang.Character java.lang.Double | java.lang.Float java.lang.Integer java.lang.Long java.lang.Short | java.lang.String java.math.BigDecimal java.sql.Date java.sql.Time | java.sql.Timestamp java.util.Date |
Unless you know the name and type of every column in the data source, it is often easier to select and export tables from the Domain Designer. The Domain Designer accesses the data source to find the names of all tables and columns, as well as their types. You may then export the XML design file with this information and refine your design.
If you have proprietary types in your database, the server may not be able to map its Java type from the JDBC driver. You can configure the mapping for proprietary types, as described in the JasperReports Server Administrator Guide. Alternatively, you can override any mapping by specifying the type attribute for any given field in the XML design file. The server uses this Java type for the field, regardless of its mapping. If your proprietary type can't be cast in the specified type, the server raises an exception. |
Recommended Comments
There are no comments to display.