Facing problem with Pojo Datasource in 4.3 [message #1146711] |
Sun, 20 October 2013 06:43  |
Eclipse User |
|
|
|
I have observed a strange behavior with pojo datasource in 4.3. The following are my java files.
dataset class that i am using for data source:-
public class StudentRegDataSet {
private Iterator<StudentRegistrationDto> iterator;
public List<StudentRegistrationDto> getStudentRegs(){
List<StudentRegistrationDto> studRegs=new ArrayList<StudentRegistrationDto>();
StudentRegistrationDto studReg=null;
try{
studReg=new StudentRegistrationDto();
PreviousEducationDetailsDto previousEduDetails=new PreviousEducationDetailsDto();
List<SubjectDto>courseSubjects=new ArrayList<SubjectDto>();
SubjectDto sub1=new SubjectDto();
sub1.setSubjectName("English");
sub1.setMarks(60);
courseSubjects.add(sub1);
SubjectDto sub2=new SubjectDto();
sub2.setSubjectName("Science");
sub2.setMarks(80);
courseSubjects.add(sub2);
previousEduDetails.setCourseSubjects(courseSubjects);
studReg.setPreviousEduDetails(previousEduDetails);
List<DocumentDto> documents=new ArrayList<DocumentDto>();
DocumentDto doc1=new DocumentDto();
doc1.setDocName("Inter Certficate");
documents.add(doc1);
DocumentDto doc2=new DocumentDto();
doc2.setDocName("10th Certficate");
documents.add(doc2);
studReg.setDocuments(documents);
}catch(Exception e){
}
studRegs.add(studReg);
return studRegs;
}
@SuppressWarnings(value = { "unchecked" })
public void open(Object obj, Map<String,Object> map) {
iterator = getStudentRegs().iterator();
}
public Object next() {
if (iterator.hasNext())
return iterator.next();
return null;
}
public void close() { }
}
All the dto's i used are normal beans which have properties and setter/getter pairs. Not doing anything else with them. In the report when i create a Pojo Datasource i am mapping this class for the data source.
And when i created the data set in the report i have added "SubjectName" and "Marks" directly. Then the values are mapped to the data elements in my report. So everything went fine. The values of the properties of SubjectDto are shown in the report for "english" and "science". Everything went fine. But when i add "DocName" to the dataset of the report the entire report goes blank and when i check the log in the server "getStudentRegs()" isbeing called for 6-7 times and finally the report goes blank. If i remove the "DocName" from the dataset of the report everything works fine.
As i have to list the "DocName" in my report to get around this problem i have created another dataset for the same report and added "docName" to it and now i mapped it with the data element in my report. Now everything works fine. But problem with this approach is "getStudentRegs()" is being called twice. The entire "List<StudentRegistrationDto>" is being build twice which could be the major performance hit.
So is there any way that i can build my entire report just with one dataset in the report assuming that more number of data sets will have multiple calls to "getStudentRegs()" which i want to avoid.
Kindly help me in this. Thanks in advance.
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04179 seconds