java - Birt Dataset oda exception -
i using pojo
data-source , creating dataset
using business logic .i trying fetch data database
, want set in particular field. have hourlyrate
database according employee hourlyrate
fetch calling service method. places calling getservice()
. getting null value.
but throws:
org.eclipse.birt.data.engine.odaconsumer.odadataexception: cannot execute statement. org.eclipse.datatools.connectivity.oda.odaexception ; java.lang.reflect.invocationtargetexception @ org.eclipse.birt.data.engine.odaconsumer.exceptionhandler.newexception(exceptionhandler.java:52) @ org.eclipse.birt.data.engine.odaconsumer.exceptionhandler.throwexception(exceptionhandler.java:108) @ org.eclipse.birt.data.engine.odaconsumer.exceptionhandler.throwexception(exceptionhandler.java:84) @ org.eclipse.birt.data.engine.odaconsumer.preparedstatement.execute(preparedstatement.java:586) @ org.eclipse.birt.data.engine.executor.datasourcequery.execute(datasourcequery.java:972) @ org.eclipse.birt.data.engine.impl.preparedodadsquery$odadsqueryexecutor.executeodiquery(preparedodadsquery.java:503) @ org.eclipse.birt.data.engine.impl.queryexecutor.execute(queryexecutor.java:1208) @ org.eclipse.birt.data.engine.impl.serviceforqueryresults.executequery(serviceforqueryresults.java:233) @ org.eclipse.birt.data.engine.impl.queryresults.getresultiterator(queryresults.java:178) @ org.eclipse.birt.report.engine.api.impl.extractionresults.nextresultiterator(extractionresults.java:157) @ org.eclipse.birt.report.designer.data.ui.dataset.datasetpreviewer.preview(datasetpreviewer.java:69) @ org.eclipse.birt.report.designer.data.ui.dataset.resultsetpreviewpage$5.run(resultsetpreviewpage.java:366) @ org.eclipse.jface.operation.modalcontext$modalcontextthread.run(modalcontext.java:121) caused by: org.eclipse.datatools.connectivity.oda.odaexception ; java.lang.reflect.invocationtargetexception @ org.eclipse.birt.data.oda.pojo.impl.internal.pojodatasetfromcustomclass.open(pojodatasetfromcustomclass.java:194) @ org.eclipse.birt.data.oda.pojo.impl.query.executequery(query.java:126) @ org.eclipse.datatools.connectivity.oda.consumer.helper.odaquery.doexecutequery(odaquery.java:480) @ org.eclipse.datatools.connectivity.oda.consumer.helper.odaquery.executequery(odaquery.java:444) @ org.eclipse.birt.data.engine.odaconsumer.preparedstatement.execute(preparedstatement.java:575) ... 9 more caused by: java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ org.eclipse.birt.data.oda.pojo.impl.internal.pojodatasetfromcustomclass.open(pojodatasetfromcustomclass.java:180) ... 13 more
birtinvoicedataset class:
public class birtinvoicedataset { private iemployeeservice employee; public birtinvoicedataset() { birtinvoicejavaobject birtinvoice = new birtinvoicejavaobject(); } @managedproperty("#{employeeservice}") private iemployeeservice employeeservice; @managedproperty("#{timesheetservice}") private itimesheetservice timesheetservice; @managedproperty("#{timesheetdetailsservice}") private itimesheetdetailsservice timesheetdetailsservice; @managedproperty("#{invoiceservice}") private iinvoiceservice invoiceservice; @managedproperty("#{projectservice}") private iprojectservice projectservice; @managedproperty("#{projectemployeeservice}") private iprojectemployeeservice projectemployeeservice; @managedproperty("#{companyservice}") icompanyservice companyservice; public list<birtinvoicejavaobject> getinvoice() { list<birtinvoicejavaobject> invoice = new arraylist<birtinvoicejavaobject>(); try { system.out.println("getting dto list"); //here getting null pointer exception list<employeedto> employeedtolist = this.getemployeeservice() .getallemployees(); system.out.println("done" + "emplooyeyey" + employeedtolist); if (employeedtolist == null) { throw new myexception(exceptioncodes.employee_null); } iterator<employeedto> employeeiterator = employeedtolist.iterator(); while (employeeiterator.hasnext()) { employeedto employee = employeeiterator.next(); string employeename = employee.getemployeename(); projectemployeedto emp = null; //dont know how data have tried lot. jar files available in /web-inf/lib folder. //here getting null pointer exception emp = getprojectemployeeservice().getprojectidbyemployeeid( employee.getemployeeid()); if (emp == null) { continue; } if (employee.getisemployeeactive() == (byte) 0) { continue; } if (emp.getprojectdto().getprojectid() == 0) continue; system.out.println("project id" + emp.getprojectdto().getprojectid()); projectdto projectdto = this.getprojectservice() .getprojectbyid(emp.getprojectdto() .getprojectid());object.setemployeename(employeename); object.sethours(hour); object.setpayment(temp.gettime()); invoice.add(objet); iterator<birtinvoicejavaobject> iterator; public void open(object appcontext, map<string, object> datasetparamvalues) { list<birtinvoicejavaobject> invoice1 = getinvoice(); iterator = invoice1.iterator(); } public object next() { while (iterator.hasnext()) { return iterator.next(); } return null; } public void close() { iterator = null; }
this birtinvoicejavaobject
pojo class
public class birtinvoicejavaobject implements serializable { /** * */ private static final long serialversionuid = 1l; private string employeename; private double total; private integer registrationnumber; private date payment; private integer hours; private integer rate; public date getpayment() { return payment; } public void setpayment(date payment) { this.payment = payment; } public integer gethours() { return hours; } public void sethours(integer hours) { this.hours = hours; } public integer getregistrationnumber() { return registrationnumber; } }
and spring-bean.xml
<bean id="birt" class="com.agranee.timesheet.birt.birtinvoicedataset"> <property name="employeeservice" ref="employeeservice" /> <property name="timesheetservice" ref="timesheetservice" /> <property name="timesheetdetailsservice" ref="timesheetdetailsservice" /> <property name="invoiceservice" ref="invoiceservice" /> <property name="projectservice" ref="projectservice"/> <property name="projectemployeeservice" ref="projectemployeeservice"/> </bean> <bean id="projectemployeeservice" class="com.agranee.timesheet.service.projectemployeeserviceimpl"> <property name="projectemployeedao" ref="projectemployeedao" /> </bean> <bean id="projectemployeedao" class="com.agranee.timesheet.dao.projectemployeedaoimpl"> <property name="sessionfactory" ref="sessionfactory" /> </bean> <bean id="projectservice" class="com.agranee.timesheet.service.projectserviceimpl"> <property name="projectdao" ref="projectdao" /> </bean> <!-- user dao declaration --> <bean id="projectdao" class="com.agranee.timesheet.dao.projectdaoimpl"> <property name="sessionfactory" ref="sessionfactory" /> </bean> <!-- user dao declaration --> <!-- user service declaration --> <!-- user service declaration --> <bean id="companyservice" class="com.agranee.timesheet.service.companyserviceimpl"> <property name="companydao" ref="companydao" /> </bean> <!--user dao declaration --> <bean id="companydao" class="com.agranee.timesheet.dao.companydaoimpl"> <property name="sessionfactory" ref="sessionfactory" /> </bean> </beans>
used tools:
- maven
- eclipse
- jsf
- hibernate
- spring3.1.0 & birt runtime 4.3
Comments
Post a Comment