Re: cayenne+jasperreports problem

From: Alan Baltazar (acatalan..ahoo.com)
Date: Fri May 12 2006 - 04:46:11 EDT

  • Next message: Juergen Saar: "Re: cayenne+jasperreports problem"

    ok. this one seems to fix the problem. i didn't know who have a choice to return a list
    of objects or datarows,

                    DataContext dataContext = DataContext.createDataContext();
                    String queryName = report.getQuery().getText();
                    SQLTemplate query = new SQLTemplate(Artist.class, queryName , true);
                    //query.isFetchingDataRows();
                    query.setFetchingDataRows(true); <----flag to return list of objects or datarows
                    List resultSet = dataContext.performQuery(query);

    --- Alan Baltazar <acatalan..ahoo.com> wrote:

    >
    > i'm new at using DataRows. i used SQLTemplate to returned the list of
    > dataobjects....instead of a list of DataRows. i'm trying to figure out how to go about
    > this returning a list of DataRows from a SQLTemplate....does anyone know of a cayenne
    > class that can do this? so i don't have to resort to writing another set of code to fix
    > this problem..i'm trying to use as much of cayenne api's as possible.
    >
    > --- Tobias.Schoessle..nvienna.org wrote:
    >
    > > Alan, did you make sure that the list you hand in contains DataRows? e.g. used
    > > SQLTemplate to create the list and set to return DataRows?
    > >
    > > Alan Baltazar <acatalan..ahoo.com> wrote:
    > > hello,
    > >
    > > i implemented this
    > > http://www.objectstyle.org/confluence/display/CAY/Jasper+Integration
    > > to integrate cayenne and jasperreports for a web application (no spring framework,
    > just
    > > straight cayenne,struts web app). my problem here, is that, I get a class cast
    > > exception
    > > for this class, DataRowDataSource (see arrow below).
    > >
    > > public class DataRowDataSource implements JRDataSource {
    > >
    > > private Iterator rowIterator;
    > > private DataRow activeRow;
    > >
    > > public DataRowDataSource(List dataRowList) {
    > > rowIterator = dataRowList.iterator();
    > > activeRow = (DataRow)rowIterator.next(); <--- cast problem here (posted
    > sample
    > >
    > > didn't have the (DataRow) cast, i
    > > added it here to compile)
    > > }
    > >
    > > public boolean next() throws JRException {
    > > boolean hasNext = rowIterator.hasNext();
    > > if (hasNext) {
    > > activeRow = (DataRow) rowIterator.next();
    > > }
    > >
    > > return hasNext;
    > > }
    > >
    > > public Object getFieldValue(JRField field) throws JRException {
    > > return activeRow.get(field.getName());
    > > }
    > >
    > > }
    > >
    > > has anyone implemented this sample? if yes, how did you fix this problem? I'm using
    > > the
    > > latest cayenne, struts, jasperreports versions.
    > >
    > > Alan,
    > >
    > > __________________________________________________
    > > Do You Yahoo!?
    > > Tired of spam? Yahoo! Mail has the best spam protection around
    > > http://mail.yahoo.com
    > >
    > > ___
    > > sent via WebmailLight 3.1.9
    > >
    >
    >
    > __________________________________________________
    > Do You Yahoo!?
    > Tired of spam? Yahoo! Mail has the best spam protection around
    > http://mail.yahoo.com
    >

    __________________________________________________
    Do You Yahoo!?
    Tired of spam? Yahoo! Mail has the best spam protection around
    http://mail.yahoo.com



    This archive was generated by hypermail 2.0.0 : Fri May 12 2006 - 04:46:48 EDT