no metadata set when using query chain with sql templates

From: Hannes Janetzek (jef..zi.de)
Date: Wed Jul 19 2006 - 19:13:36 EDT

  • Next message: Andrus Adamchik: "Re: no metadata set when using query chain with sql templates"

    Hello,

    I have a problem with using the queryChain. I could track down the error
    to the point, that the generic metadata has no data and so
    conversion fails. Thats where the null-pointer comes from.

    QueryChain query = new QueryChain();
    query.addQuery(new SQLTemplate(Bibtex.class, "select * FROM BIBTEX
    WHERE "+type[i]+" REGEXP \""+keyword+"\""));
    getDataContext().performQuery(query)

    The error-stack:

    WARN RequestProcessor: Unhandled Exception thrown: class
    java.lang.NullPointerException ERROR [action]: Servlet.service() for
    servlet action threw exception java.lang.NullPointerException
    at
    org.objectstyle.cayenne.access.ObjectResolver.init(ObjectResolver.java:102)
    at
    org.objectstyle.cayenne.access.ObjectResolver.<init>(ObjectResolver.java:93)
    at
    org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:373)
    at
    org.objectstyle.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:151)
    at
    org.objectstyle.cayenne.access.DataDomain.onQuery(DataDomain.java:766)
    at
    org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:253)
    at
    org.objectstyle.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:90)
    at
    org.objectstyle.cayenne.access.DataContext.onQuery(DataContext.java:1422)
    at
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1411)
    at dbAccess.DBAccess.findBibtexByRegex(DBAccess.java:95)

    On the other hand this works well:
            
    SQLTemplate select = new SQLTemplate(Bibtex.class, "select *
    FROM BIBTEX WHERE "+type+" REGEXP \""+keyword+"\"");
    getDataContext().performQuery(select);

    The problem with this is that if have many items found more than once
    that I have to filter out then.

    Am I doing somethig wrong or this a known issue?

    Regards,
    Hannes Janetzek



    This archive was generated by hypermail 2.0.0 : Wed Jul 19 2006 - 17:11:01 EDT