Grokbase Groups Cayenne dev June 2008
FAQ
org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
--------------------------------------------------------------------------------

Key: CAY-1072
URL: https://issues.apache.org/cayenne/browse/CAY-1072
Project: Cayenne
Issue Type: Bug
Components: Cayenne JPA
Affects Versions: 3.0
Environment: ROP
Reporter: Lachlan Deck
Assignee: Andrus Adamchik


so I've got this...
public int allRecordsCount(Expression e) {
ObjEntity entity = getContext().getEntityResolver().lookupObjEntity(getObjectClass());
Expression qualifier = null;
<...>
String ejbqlWhereString = qualifier == null ? "" : " WHERE " + qualifier.toEJBQL("a");
String ejbqlQueryString = "SELECT count(a) FROM " + entity.getName() + " a" + ejbqlWhereString;
EJBQLQuery ejbqlQuery = new EJBQLQuery(ejbqlQueryString);
Number count = (Number) DataObjectUtils.objectForQuery(getContext(), ejbqlQuery);
return count.intValue();
}

But I'm getting this exception. Any ideas?

org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT May 14 2008 22:35:23] Remote error. URL - http://delish.ish.com.au:8181/angel-server-cayenne; CAUSE - Serialized class org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
[java] at org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:147)
[java] at org.apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:73)
[java] at org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:281)
[java] at org.apache.cayenne.remote.ClientChannel.onQuery(ClientChannel.java:113)
[java] at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:317)
[java] at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
[java] at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:340)
[java] at org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:328)
[java] at ish.oncourse.cayenne.CayenneContext.performQuery(CayenneContext.java:292)
[java] at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:274)
[java] at ish.oncourse.controller.ListController.allRecordsCount(ListController.java:482)


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Search Discussions

  • Anonymous at Jun 10, 2008 at 8:59 am
    [ https://issues.apache.org/cayenne/browse/CAY-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12945#action_12945 ]

    Lachlan Deck commented on CAY-1072:
    -----------------------------------

    There's a problem also when dates are involved for comparison...

    org.apache.cayenne.ejbql.EJBQLException: [v.3.0-SNAPSHOT May 14 2008 22:35:23] Error parsing EJB QL statement
    [java] at org.apache.cayenne.ejbql.parser.EJBQL$EJBQLDefaultParser.compile(EJBQL.java:31)
    [java] at org.apache.cayenne.query.EJBQLQuery.getExpression(EJBQLQuery.java:84)
    [java] at org.apache.cayenne.query.EJBQLQueryMetadata.resolve(EJBQLQueryMetadata.java:45)
    [java] at org.apache.cayenne.query.EJBQLQuery.getMetaData(EJBQLQuery.java:52)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.<init>(ObjectContextQueryAction.java:79)
    [java] at org.apache.cayenne.CayenneContextQueryAction.<init>(CayenneContextQueryAction.java:41)
    [java] at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:340)
    [java] at org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:328)
    [java] at ish.oncourse.cayenne.CayenneContext.performQuery(CayenneContext.java:292)
    [java] at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:274)
    [java] at ish.oncourse.controller.ListController.allRecordsCount(ListController.java:420)
    [java] at ish.view.components.OutputList$8.run(OutputList.java:567)
    [java] at foxtrot.AbstractWorkerThread$1.run(AbstractWorkerThread.java:39)
    [java] at java.security.AccessController.doPrivileged(Native Method)
    [java] at foxtrot.AbstractWorkerThread.runTask(AbstractWorkerThread.java:35)
    [java] at foxtrot.workers.SingleWorkerThread.run(SingleWorkerThread.java:196)
    [java] at foxtrot.workers.SingleWorkerThread.run(SingleWorkerThread.java:179)
    [java] at java.lang.Thread.run(Thread.java:613)
    [java] Caused by: org.apache.cayenne.ejbql.parser.ParseException: Encountered "a . student . enrolments . courseClass . endDateTime >= Tue Jun" at line 1, column 117.
    [java] Was expecting one of:
    [java] "(" ...
    [java] "NOT" ...
    [java] "+" ...
    [java] "-" ...
    [java] <DECIMAL_LITERAL> ...
    [java] <INTEGER_LITERAL> ...
    [java] ":" ...
    [java] "?" ...
    [java] "db:" ...
    [java] <IDENTIFIER> "." "NEW" ...
    [java] <IDENTIFIER> "." "ALL" ...
    [java] <IDENTIFIER> "." "ANY" ...
    [java] <IDENTIFIER> "." "EXISTS" ...
    <...etc ...>
    [java]
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.generateParseException(EJBQL.java:9409)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.jj_consume_token(EJBQL.java:9286)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1931)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1909)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1774)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1736)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1926)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1909)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1774)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1736)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_primary(EJBQL.java:1926)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_factor(EJBQL.java:1909)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1774)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1787)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_term(EJBQL.java:1787)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.conditional_expression(EJBQL.java:1736)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.where_clause(EJBQL.java:1583)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.select_statement(EJBQL.java:67)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL.parseQuery(EJBQL.java:39)
    [java] at org.apache.cayenne.ejbql.parser.EJBQL$EJBQLDefaultParser.compile(EJBQL.java:28)
    [java] ... 17 more

    org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
    --------------------------------------------------------------------------------

    Key: CAY-1072
    URL: https://issues.apache.org/cayenne/browse/CAY-1072
    Project: Cayenne
    Issue Type: Bug
    Components: Cayenne JPA
    Affects Versions: 3.0
    Environment: ROP
    Reporter: Lachlan Deck
    Assignee: Andrus Adamchik

    so I've got this...
    public int allRecordsCount(Expression e) {
    ObjEntity entity = getContext().getEntityResolver().lookupObjEntity(getObjectClass());
    Expression qualifier = null;
    <...>
    String ejbqlWhereString = qualifier == null ? "" : " WHERE " + qualifier.toEJBQL("a");
    String ejbqlQueryString = "SELECT count(a) FROM " + entity.getName() + " a" + ejbqlWhereString;
    EJBQLQuery ejbqlQuery = new EJBQLQuery(ejbqlQueryString);
    Number count = (Number) DataObjectUtils.objectForQuery(getContext(), ejbqlQuery);
    return count.intValue();
    }
    But I'm getting this exception. Any ideas?
    org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT May 14 2008 22:35:23] Remote error. URL - http://delish.ish.com.au:8181/angel-server-cayenne; CAUSE - Serialized class org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
    [java] at org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:147)
    [java] at org.apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:73)
    [java] at org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:281)
    [java] at org.apache.cayenne.remote.ClientChannel.onQuery(ClientChannel.java:113)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:317)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
    [java] at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:340)
    [java] at org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:328)
    [java] at ish.oncourse.cayenne.CayenneContext.performQuery(CayenneContext.java:292)
    [java] at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:274)
    [java] at ish.oncourse.controller.ListController.allRecordsCount(ListController.java:482)
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Anonymous at Jun 10, 2008 at 9:06 am
    [ https://issues.apache.org/cayenne/browse/CAY-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12946#action_12946 ]

    Andrus Adamchik commented on CAY-1072:
    --------------------------------------

    Yes, converting dates to Strings are a no-go. I don't see us being able to fix that on the short run. Could you try a parameterized expression instead (using $param instead of date literals).
    org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
    --------------------------------------------------------------------------------

    Key: CAY-1072
    URL: https://issues.apache.org/cayenne/browse/CAY-1072
    Project: Cayenne
    Issue Type: Bug
    Components: Cayenne JPA
    Affects Versions: 3.0
    Environment: ROP
    Reporter: Lachlan Deck
    Assignee: Andrus Adamchik

    so I've got this...
    public int allRecordsCount(Expression e) {
    ObjEntity entity = getContext().getEntityResolver().lookupObjEntity(getObjectClass());
    Expression qualifier = null;
    <...>
    String ejbqlWhereString = qualifier == null ? "" : " WHERE " + qualifier.toEJBQL("a");
    String ejbqlQueryString = "SELECT count(a) FROM " + entity.getName() + " a" + ejbqlWhereString;
    EJBQLQuery ejbqlQuery = new EJBQLQuery(ejbqlQueryString);
    Number count = (Number) DataObjectUtils.objectForQuery(getContext(), ejbqlQuery);
    return count.intValue();
    }
    But I'm getting this exception. Any ideas?
    org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT May 14 2008 22:35:23] Remote error. URL - http://delish.ish.com.au:8181/angel-server-cayenne; CAUSE - Serialized class org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
    [java] at org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:147)
    [java] at org.apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:73)
    [java] at org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:281)
    [java] at org.apache.cayenne.remote.ClientChannel.onQuery(ClientChannel.java:113)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:317)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
    [java] at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:340)
    [java] at org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:328)
    [java] at ish.oncourse.cayenne.CayenneContext.performQuery(CayenneContext.java:292)
    [java] at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:274)
    [java] at ish.oncourse.controller.ListController.allRecordsCount(ListController.java:482)
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Anonymous at Jun 10, 2008 at 10:47 am
    [ https://issues.apache.org/cayenne/browse/CAY-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12947#action_12947 ]

    Andrus Adamchik commented on CAY-1072:
    --------------------------------------

    On the other hand, we need some way to handle dates or other parameters that can't be converted into literals... I guess one way is to generate "synthetic" parameters and collect values in a map passed as an argument,
    org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
    --------------------------------------------------------------------------------

    Key: CAY-1072
    URL: https://issues.apache.org/cayenne/browse/CAY-1072
    Project: Cayenne
    Issue Type: Bug
    Components: Cayenne JPA
    Affects Versions: 3.0
    Environment: ROP
    Reporter: Lachlan Deck
    Assignee: Andrus Adamchik

    so I've got this...
    public int allRecordsCount(Expression e) {
    ObjEntity entity = getContext().getEntityResolver().lookupObjEntity(getObjectClass());
    Expression qualifier = null;
    <...>
    String ejbqlWhereString = qualifier == null ? "" : " WHERE " + qualifier.toEJBQL("a");
    String ejbqlQueryString = "SELECT count(a) FROM " + entity.getName() + " a" + ejbqlWhereString;
    EJBQLQuery ejbqlQuery = new EJBQLQuery(ejbqlQueryString);
    Number count = (Number) DataObjectUtils.objectForQuery(getContext(), ejbqlQuery);
    return count.intValue();
    }
    But I'm getting this exception. Any ideas?
    org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT May 14 2008 22:35:23] Remote error. URL - http://delish.ish.com.au:8181/angel-server-cayenne; CAUSE - Serialized class org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
    [java] at org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:147)
    [java] at org.apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:73)
    [java] at org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:281)
    [java] at org.apache.cayenne.remote.ClientChannel.onQuery(ClientChannel.java:113)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:317)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
    [java] at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:340)
    [java] at org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:328)
    [java] at ish.oncourse.cayenne.CayenneContext.performQuery(CayenneContext.java:292)
    [java] at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:274)
    [java] at ish.oncourse.controller.ListController.allRecordsCount(ListController.java:482)
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Anonymous at Jun 10, 2008 at 11:39 am
    [ https://issues.apache.org/cayenne/browse/CAY-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Andrus Adamchik closed CAY-1072.
    --------------------------------

    Resolution: Fixed
    Fix Version/s: 3.0

    the other part of the issue (toEJBQLString(..)) will be tracked via a different Jira (likely CAY-1073 that seems like a similar problem)
    EJBQLQuery non-serializable exception when run via ROP
    ------------------------------------------------------

    Key: CAY-1072
    URL: https://issues.apache.org/cayenne/browse/CAY-1072
    Project: Cayenne
    Issue Type: Bug
    Components: Cayenne JPA
    Affects Versions: 3.0
    Environment: ROP
    Reporter: Lachlan Deck
    Assignee: Andrus Adamchik
    Fix For: 3.0


    so I've got this...
    public int allRecordsCount(Expression e) {
    ObjEntity entity = getContext().getEntityResolver().lookupObjEntity(getObjectClass());
    Expression qualifier = null;
    <...>
    String ejbqlWhereString = qualifier == null ? "" : " WHERE " + qualifier.toEJBQL("a");
    String ejbqlQueryString = "SELECT count(a) FROM " + entity.getName() + " a" + ejbqlWhereString;
    EJBQLQuery ejbqlQuery = new EJBQLQuery(ejbqlQueryString);
    Number count = (Number) DataObjectUtils.objectForQuery(getContext(), ejbqlQuery);
    return count.intValue();
    }
    But I'm getting this exception. Any ideas?
    org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT May 14 2008 22:35:23] Remote error. URL - http://delish.ish.com.au:8181/angel-server-cayenne; CAUSE - Serialized class org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
    [java] at org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:147)
    [java] at org.apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:73)
    [java] at org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:281)
    [java] at org.apache.cayenne.remote.ClientChannel.onQuery(ClientChannel.java:113)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:317)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
    [java] at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:340)
    [java] at org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:328)
    [java] at ish.oncourse.cayenne.CayenneContext.performQuery(CayenneContext.java:292)
    [java] at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:274)
    [java] at ish.oncourse.controller.ListController.allRecordsCount(ListController.java:482)
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
  • Anonymous at Jun 10, 2008 at 11:39 am
    [ https://issues.apache.org/cayenne/browse/CAY-1072?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

    Andrus Adamchik updated CAY-1072:
    ---------------------------------

    Summary: EJBQLQuery non-serializable exception when run via ROP (was: org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable)

    Editing title to avoid confusion in release-notes, as the actual fix was the opposite of the one requested
    EJBQLQuery non-serializable exception when run via ROP
    ------------------------------------------------------

    Key: CAY-1072
    URL: https://issues.apache.org/cayenne/browse/CAY-1072
    Project: Cayenne
    Issue Type: Bug
    Components: Cayenne JPA
    Affects Versions: 3.0
    Environment: ROP
    Reporter: Lachlan Deck
    Assignee: Andrus Adamchik
    Fix For: 3.0


    so I've got this...
    public int allRecordsCount(Expression e) {
    ObjEntity entity = getContext().getEntityResolver().lookupObjEntity(getObjectClass());
    Expression qualifier = null;
    <...>
    String ejbqlWhereString = qualifier == null ? "" : " WHERE " + qualifier.toEJBQL("a");
    String ejbqlQueryString = "SELECT count(a) FROM " + entity.getName() + " a" + ejbqlWhereString;
    EJBQLQuery ejbqlQuery = new EJBQLQuery(ejbqlQueryString);
    Number count = (Number) DataObjectUtils.objectForQuery(getContext(), ejbqlQuery);
    return count.intValue();
    }
    But I'm getting this exception. Any ideas?
    org.apache.cayenne.CayenneRuntimeException: [v.3.0-SNAPSHOT May 14 2008 22:35:23] Remote error. URL - http://delish.ish.com.au:8181/angel-server-cayenne; CAUSE - Serialized class org.apache.cayenne.query.SQLResultSetMapping must implement java.io.Serializable
    [java] at org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage(HessianConnection.java:147)
    [java] at org.apache.cayenne.remote.BaseConnection.sendMessage(BaseConnection.java:73)
    [java] at org.apache.cayenne.remote.ClientChannel.send(ClientChannel.java:281)
    [java] at org.apache.cayenne.remote.ClientChannel.onQuery(ClientChannel.java:113)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:317)
    [java] at org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:96)
    [java] at org.apache.cayenne.CayenneContext.onQuery(CayenneContext.java:340)
    [java] at org.apache.cayenne.CayenneContext.performQuery(CayenneContext.java:328)
    [java] at ish.oncourse.cayenne.CayenneContext.performQuery(CayenneContext.java:292)
    [java] at org.apache.cayenne.DataObjectUtils.objectForQuery(DataObjectUtils.java:274)
    [java] at ish.oncourse.controller.ListController.allRecordsCount(ListController.java:482)
    --
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categoriescayenne
postedJun 10, '08 at 8:40a
activeJun 10, '08 at 11:39a
posts6
users1
websitecayenne.apache.org

1 user in discussion

Anonymous: 6 posts

People

Translate

site design / logo © 2021 Grokbase