OpenJPA
  1. OpenJPA
  2. OPENJPA-812

slices: aggregate queries fail if any slice has empty results

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M1
    • Fix Version/s: 2.0.0-M1
    • Component/s: slice
    • Labels:
      None

      Description

      NPE when doing aggregate queries. I can only guess that it's because the results from a slice is null. Easy fix. I will attach a very small patch.

      2008-12-03 18:14:13,348 [pool-2-thread-2] ERROR com.protrade.fanwars.base.services.FanwarsAppEventHandlerWorker - doRefreshTeamFanBasePoints: Trouble loading TeamFan: <<TeamFanId:TeamFan:8574250>>
      <openjpa-2.0.0-SNAPSHOT-r422266:723088M nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Failed to execute query "select count( this ), max( this.createTime ) from com.protrade.fandom.data.entities.CheerStatus this where this.teamFan = :p0 AND this.createTime > :p1 AND this.createTime <= :p2 AND this.points > 0". Check the query syntax for correctness. See nested exception for details.
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:857)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:779)
      at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525)
      at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:257)
      at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:452)
      at com.protrade.common.persistence.JPAUtil.execute(JPAUtil.java:181)
      at com.protrade.common.persistence.JPAUtil.executeUnique(JPAUtil.java:162)
      at com.protrade.common.persistence.JPADQuery.uniqueResult(JPADQuery.java:32)
      at com.protrade.common.persistence.BaseRootDAOBase.runUniqueQueryNCS(BaseRootDAOBase.java:290)
      at com.protrade.common.persistence.BaseDAOBase.runUniqueQueryNCS(BaseDAOBase.java:132)
      at com.protrade.fandom.data.FandomCoreDAO.getCheerStatusCountLastDate(FandomCoreDAO.java:582)
      at com.protrade.fandom.data.FandomCoreDAO.getTeamFanBasePointsCount(FandomCoreDAO.java:547)
      at com.protrade.fanwars.base.services.FanwarsAppEventHandlerWorker.doRefreshTeamFanBasePoints(FanwarsAppEventHandlerWorker.java:795)
      at com.protrade.fanwars.base.services.FanwarsAppEventHandler$11.run2(FanwarsAppEventHandler.java:270)
      at com.protrade.fanwars.base.services.FanwarsAppEventHandler$FanwarsWorkerRunnable.run(FanwarsAppEventHandler.java:441)
      at com.protrade.common.spring.OpenEMFilter$BindThreadRunnable.run(OpenEMFilter.java:129)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
      at java.util.concurrent.FutureTask.run(FutureTask.java:123)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:65)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:168)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
      at org.apache.openjpa.slice.jdbc.UniqueResultObjectProvider.max(UniqueResultObjectProvider.java:126)
      at org.apache.openjpa.slice.jdbc.UniqueResultObjectProvider.next(UniqueResultObjectProvider.java:98)
      at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1292)
      at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1226)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:995)
      at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:848)
      ... 23 more

      1. urop.diff
        2 kB
        Fernando Padilla

        Activity

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development