OpenJPA
  1. OpenJPA
  2. OPENJPA-886

Certain query failing after svn:739123

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 2.0.0-M1, 2.0.0-M2
    • Component/s: kernel
    • Labels:
      None

      Description

      We were using the nightly snapshot builds, then this morning our app stopped working. A certain query ( it looks quite normal to me ), fails, and we have no clue what's going on.

      The stack trace is below. It complains that a parameter type is not allowed, even though it has been working until that check-in. And the type is a normal Entity, related through a ManyToOne relationship from the other class.. The class code excerpts are below as well..

      2009-01-30 11:43:31,349 [btpool0-1] DEBUG openjpa.Query - Executing query: [SELECT t0.JDOID, t0.CREATETIME, t0.BRACKET_JDOID, t0.GROUP0, t0.USER_JDOID FROM BRACKETEER t0 WHERE (t0.GROUP0 = ? AND t0.USER_JDOID = ?)] with parameters:

      {1=com.protrade.bracket.data.entities.User@b1406b[ fbId=578696943 appAdded=false recruiter=<null> numMinibrackets=0 numBrackets=0 createTime=1233343722122 idLong=9000 jdoId=<null> jdoversion=0 ], 0=<<BracketGroupId:BracketGroup:32>>}


      2009-01-30 11:28:42,483 [btpool0-2] ERROR com.protrade.bracket.fbsite.filters.AppSubscriptionHandler - The specified parameter of type "class com.protrade.bracket.data.entities.User" is not a valid query parameter.
      <openjpa-2.0.0-SNAPSHOT-r422266:739178 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: The specified parameter of type "class com.protrade.bracket.data.entities.User" is not a valid query parameter.
      at org.apache.openjpa.jdbc.sql.DBDictionary.setUnknown(DBDictionary.java:1354)
      at org.apache.openjpa.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeQuery(SQLStoreQuery.java:314)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:997)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:846)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:777)
      at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525)
      at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:274)
      at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:284)
      at com.protrade.common.persistence.JPAUtil.execute(JPAUtil.java:195)
      at com.protrade.common.persistence.JPAUtil.execute(JPAUtil.java:170)
      at com.protrade.common.persistence.JPAUtil.executeList(JPAUtil.java:155)
      at com.protrade.common.persistence.JPADQuery.list(JPADQuery.java:24)
      at com.protrade.common.persistence.BaseRootDAOBase.runListQueryWithListNCS(BaseRootDAOBase.java:272)
      at com.protrade.common.persistence.BaseRootDAOBase.findByFieldsNCS(BaseRootDAOBase.java:199)
      at com.protrade.common.persistence.BaseRootDAOBase.existsByFieldsNCS(BaseRootDAOBase.java:236)
      at com.protrade.common.persistence.BaseDAOBase.existsByFieldsNCS(BaseDAOBase.java:144)
      at com.protrade.bracket.data.BracketDao.isBracketeer(BracketDao.java:152)

      @Entity
      public class Bracketeer extends HBaseIdCreateTime implements IBracketeer {
      ...
      @Persistent
      @Externalizer( "getIdLong" )
      private BracketGroupId group;

      @ManyToOne
      @JoinColumn( name = "USER_JDOID" )
      private User user;
      ...
      }

      @Entity
      public class User extends HBaseIdCreateTime implements UnifiedSocialUser {
      ...
      }

        Issue Links

          Activity

          Hide
          Catalina Wei added a comment -

          Pinaki,
          The attached file contains a simple query string that could help you debugging the problem:

          String query = "UPDATE CompUser e set e.name= ?1, e.age = ?2 WHERE e.userid = ?3";

          int count = em.createQuery(query).
          setParameter(1, "Shannon").
          setParameter(2, 29).
          setParameter(3, userid2).
          executeUpdate();

          You could add a version column to CompUser entity for non-user parameter.

          Show
          Catalina Wei added a comment - Pinaki, The attached file contains a simple query string that could help you debugging the problem: String query = "UPDATE CompUser e set e.name= ?1, e.age = ?2 WHERE e.userid = ?3"; int count = em.createQuery(query). setParameter(1, "Shannon"). setParameter(2, 29). setParameter(3, userid2). executeUpdate(); You could add a version column to CompUser entity for non-user parameter.
          Hide
          Fernando Padilla added a comment -

          Catalina Wei commented that the stacktrace looked to be using a SQL query instead of a JPQL query ( which is what our code is expecting to use ). So I can only guess that the large checkin at svn:739123, might have a typo, that is executing the wrong code path.

          I am sorry, but I don't have the JPQL query at the moment.. though I have logging turned up to TRACE, openjpa didn't seem to print it out..

          but it's really straight forward.. something like (psedo code) "select * from ...Braketeer as this where this.group = :p0 and this.user = :p1"

          Show
          Fernando Padilla added a comment - Catalina Wei commented that the stacktrace looked to be using a SQL query instead of a JPQL query ( which is what our code is expecting to use ). So I can only guess that the large checkin at svn:739123, might have a typo, that is executing the wrong code path. I am sorry, but I don't have the JPQL query at the moment.. though I have logging turned up to TRACE, openjpa didn't seem to print it out.. but it's really straight forward.. something like (psedo code) "select * from ...Braketeer as this where this.group = :p0 and this.user = :p1"

            People

            • Assignee:
              Unassigned
              Reporter:
              Fernando Padilla
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development