Jump to content
We've recently updated our Privacy Statement, available here ×

JavaBean Datasource won't display attributes


icccapital

Recommended Posts

I am at a total loss.  I have gotten this to work before, but everything I have done I can't seem to get the attributes to display in the report query in Ireport.  My code is below for the factory class.  I have jarred the three classes in one jar file.  I have added the jar file to the classpath in ireport and I have created a new connection/datasource with the following information

JavaBeans set datasource

name: Mailers

FactoryClass: beanCollect.BeanCollection

checked Collection of JavaBeans

method: createBeanCollection

Can anyone give me something else to try, thanks

Code:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package beanCollect;import java.util.ArrayList;import java.util.List;import org.myapp.model.Contacts;import org.myapp.model.Clients;public class BeanCollection {    public static List createBeanCollection(){        List<Clients> myList = new ArrayList<Clients>();        Contacts co = new Contacts();        Clients cl = new Clients();        co.setiD1(new Long(10));        co.setCompany("Company");        co.setFirstName("Bill");        co.setLastName("Lung");        co.setAddress("10 place");        co.setAddress2("Address 2");        co.setCity("Orlando");        co.setState("FL");        co.setZipCode("32801");        List<Contacts> lc = new ArrayList<Contacts>();        cl.setPosition("Doctor");        lc.add(co);        cl.setContacts(lc);        myList.add(cl);        return myList;    }}
Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I stepped away from the project for a bit and so just came back and figured out what I was doing wrong.

 

For those who need this info, I figured out that you have to have the createBeanCollection (aggregator of the list of objects) method in the bean that has all of the attributes. 

 

Maybe in future versions this won't be a limitation.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...