Jasper error Long/Integer directly after record creation

Questions and answers on developing, deploying and using plugins and JavaBeans

Jasper error Long/Integer directly after record creation

Postby deezzub » Tue Oct 29, 2013 4:33 pm

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

Code: Select all
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
<null>
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.:

Code: Select all
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?
Last edited by deezzub on Wed Nov 27, 2013 5:33 pm, edited 1 time in total.
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Jasper error Long/Integer directly after record creation

Postby deezzub » Wed Oct 30, 2013 2:48 pm

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.
deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany

Re: Jasper error Long/Integer directly after record creation

Postby vincentc » Wed Nov 27, 2013 12:26 pm

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 ...
vincentc
 
Posts: 56
Joined: Thu Aug 25, 2011 11:12 am

Re: Jasper error Long/Integer directly after record creation

Postby rgansevles » Wed Nov 27, 2013 1:00 pm

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
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: Jasper error Long/Integer directly after record creation

Postby deezzub » Wed Nov 27, 2013 5:31 pm

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


Then I get:

Code: Select all
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)

deezzub
 
Posts: 328
Joined: Tue May 28, 2013 3:02 pm
Location: Oldenburg, Germany


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 12 guests

cron