Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Facing problem with Pojo Datasource in 4.3
Facing problem with Pojo Datasource in 4.3 [message #1146711] Sun, 20 October 2013 10:43 Go to next message
Muralidhar Yaragalla is currently offline Muralidhar YaragallaFriend
Messages: 38
Registered: January 2011
Location: Ponnur
Member

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.


Thanks and Regards,
Muralidhar Yaragalla.
http://yaragalla.blogspot.in
Re: Facing problem with Pojo Datasource in 4.3 [message #1148678 is a reply to message #1146711] Mon, 21 October 2013 17:20 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Any way you can reproduce this issue in a report that I can run so I can test? Thanks.

Michael

Developer Evangelist, Silanis
Re: Facing problem with Pojo Datasource in 4.3 [message #1148717 is a reply to message #1148678] Mon, 21 October 2013 17:51 Go to previous messageGo to next message
Muralidhar Yaragalla is currently offline Muralidhar YaragallaFriend
Messages: 38
Registered: January 2011
Location: Ponnur
Member

The following are the links(reports can be downloaded from these links) for the reports that demonstrate the issue

I am uploading the two rpt design files. "test.rpt" is the one which is working and before adding the "documentName" field to dataset, The "testNotWorking.rpt" is the one which is not working when i add "docName" to the dataset. This is too strange. when it is working for courseSubjects why is it not working for "documents". How to understand this behaviour?

https://docs.google.com/file/d/0B59LVhKQaKQYeFNDcnhxZ3pCWVE/edit?usp=sharing

https://docs.google.com/file/d/0B59LVhKQaKQYcmoyZVVpZ1RCMlk/edit?usp=sharing

The following is the link for the jar file. I have hard coded the data for your convenience so that you will be able to see the report easily.

https://docs.google.com/file/d/0B59LVhKQaKQYa2RIUldGM0dfSm8/edit?usp=sharing


Thanks and Regards,
Muralidhar Yaragalla.
http://yaragalla.blogspot.in

[Updated on: Mon, 21 October 2013 17:54]

Report message to a moderator

Re: Facing problem with Pojo Datasource in 4.3 [message #1150847 is a reply to message #1148717] Wed, 23 October 2013 02:01 Go to previous messageGo to next message
Muralidhar Yaragalla is currently offline Muralidhar YaragallaFriend
Messages: 38
Registered: January 2011
Location: Ponnur
Member

do anyone have a solution for this?

Thanks and Regards,
Muralidhar Yaragalla.
http://yaragalla.blogspot.in
Re: Facing problem with Pojo Datasource in 4.3 [message #1173697 is a reply to message #1148717] Wed, 06 November 2013 17:55 Go to previous messageGo to next message
Muralidhar Yaragalla is currently offline Muralidhar YaragallaFriend
Messages: 38
Registered: January 2011
Location: Ponnur
Member

This is the jar including binaries and source.

Thanks and Regards,
Muralidhar Yaragalla.
http://yaragalla.blogspot.in
Re: Facing problem with Pojo Datasource in 4.3 [message #1182998 is a reply to message #1173697] Tue, 12 November 2013 15:19 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

It would appear that the problem you're having with the report not working is that when you return docName, it returns a list of docs and the POJO is trying to create a single row with an arrayList. When I run your report, I get an error that says something about 1 to n, so I'm assuming this is the cause for this error.

Michael

Developer Evangelist, Silanis
Re: Facing problem with Pojo Datasource in 4.3 [message #1183007 is a reply to message #1182998] Tue, 12 November 2013 15:23 Go to previous messageGo to next message
Muralidhar Yaragalla is currently offline Muralidhar YaragallaFriend
Messages: 38
Registered: January 2011
Location: Ponnur
Member

Thank you for replying. But if u carefully look at it, it is the same case with subjects which are being displayed properly. So why is it working in one case why not in another?

Thanks and Regards,
Muralidhar Yaragalla.
http://yaragalla.blogspot.in
Re: Facing problem with Pojo Datasource in 4.3 [message #1183023 is a reply to message #1183007] Tue, 12 November 2013 15:34 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Ah. I hadn't made it that far through the code, yet. Try working with just the documents list and not the subjects and see if it works only using one list, no matter which one. If it works with just the docs being used, please file a bug and post the bug info in here. Thanks.

Michael

Developer Evangelist, Silanis
Re: Facing problem with Pojo Datasource in 4.3 [message #1183036 is a reply to message #1183023] Tue, 12 November 2013 15:41 Go to previous message
Muralidhar Yaragalla is currently offline Muralidhar YaragallaFriend
Messages: 38
Registered: January 2011
Location: Ponnur
Member

ya it is working for docs when i remove subjects. So when there is one list it is working.

Thanks and Regards,
Muralidhar Yaragalla.
http://yaragalla.blogspot.in
Previous Topic:Birt viewer error - adding OJDBC14 jar
Next Topic:Printing reports and the cancel button in progressbar
Goto Forum:
  


Current Time: Wed Dec 04 13:30:37 GMT 2024

Powered by FUDForum. Page generated in 0.04197 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top