我正在使用NetBeans 8.0.2的IReport-5.6.0插件。
如何在报告中显示此字段?。
Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '2015-03-22' with class 'java.time.LocalDate' to class 'java.sql.Date'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
at null_1427308438299_735647.evaluate(calculator_null_1427308438299_735647:170)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:250)
... 77 more
我的jrxml中的查询部分:
<queryString language="SQL">
<![CDATA[SELECT
USER."NAME" AS name,
USER."EMAIL" AS email,
USER."BIRTHDAY" AS birthday
FROM
"PUBLIC"."USER" USER]]>
</queryString>
<field name="name" class="java.lang.String"/>
<field name="email" class="java.lang.String"/>
<field name="birthday" class="java.sql.Date"/>
我的java类有以下方法:
private void printOut(ActionEvent event) throws JRException {
String report = "report1.jrxml";
JRBeanCollectionDataSource beanCollectionDataSource = new JRBeanCollectionDataSource(data);
JasperReport jas_rep = JasperCompileManager.compileReport(report) ;
JasperPrint jas_prin = JasperFillManager.fillReport(jas_rep,null,beanCollectionDataSource);
JasperViewer.viewReport(jas_prin);
}