Jasper error Long/Integer directly after record creation

I get the following exception after I run the Jasper report.:

Exception Object: java.lang.Exception: java.lang.Long cannot be cast to java.lang.Integer

MSG: java.lang.Long cannot be cast to java.lang.Integer

Exception calling form method ‘printPreview’ with arguments [-1, -1, false, null, Druckvorschau] on form ‘boss_char_charterfaktura_base_dtl’ in async mode on solution BOSS
Wrapped java.lang.Exception: java.lang.Long cannot be cast to java.lang.Integer (H:\servoy_workspace_git\br_boss\br_boss_chart_faktura\forms\boss_char_charterfaktura_base_dtl.js#824)
at H:\servoy_workspace_git\br_boss\br_boss_chart_faktura\forms\boss_char_charterfaktura_base_dtl.js:824 (printPreview)

If close the smart client, reopen it, then the Jasper report run works.

The following method calls the report.:

function printPreview() {
	if ( id ) {
		plugins.jasperPluginRMI.runReport( db.DATABASE.BOSS_SQL, charterfakturaReport, null, "viewer", { param_id: foundset.id }, getDocumentLanguage( ) );
	}
}

The parameter param_id and the field id are declared as java.lang.Integer in iReport Designer.

What is the cause for this error?

I changed the paramater param_id and the field id in iReport from java.lang.Integer to java.lang.String.

Now it works directly after record saving.

Thank you so much to have posting the solution of this problem … I was going crazy with it !
I think this is a bug of the JasperReports plugin …

What probably happens here is that the column type is defined as integer in the database, so Servoy creates Integers when creating new records.
But when existing data is loaded from the db, that data is used, so if the driver returns Longs we pass those to the report.

Can’t you define the parameter as java.lang.Number? this should cover both Integer and Long.

Rob

rgansevles:
Can’t you define the parameter as java.lang.Number? this should cover both Integer and Long.

Then I get:

net.sf.jasperreports.engine.design.JRValidationException: Report design not valid :       1. Parameter type not supported in query : param_id class java.lang.Number     at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:271)     at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:153)     at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:512)     at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)     at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)