Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-2156

ActivityMonitorEngine uses ?1 parameters in JPAQL, which don't work with (at least) the hibernate JPA provider.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0
    • 2.1.0
    • camel-bam
    • None
    • Spring 2.5.6, camel 2.0.0, hibernate 3.3.2.GA/3.4.0GA

    Description

      Trying to just replace my RouteBuilder with a ProcessBuilder to start moving towards using BAM. I converted everything over to JPA, to make bam happy, but then found that it still explodes (Full stack trace below)

      Line 80 of ActivityMonitorEngine has this JPAQL,
      List<ActivityState> list = template.find("select x from " + ActivityState.class.getName() + " x where x.timeOverdue < ?1", timeNow);

      The ?1 named/numbered parameter seems to not be supported by hibernate's JPA provider.

      I can't find much of any documentation on this, could this just be made a normal positional? I can't even try out the BAM module without this

      2009-11-11 01:33:53,815 ERROR [org.apache.camel.bam.processor.ActivityMonitorEngine:ActivityMonitorEngine] - <Caught: org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.QueryParameterException: could not locate named parameter [1]; nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [1]>
      org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.QueryParameterException: could not locate named parameter [1]; nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [1]
      at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:271)
      at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:97)
      at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:212)
      at org.springframework.orm.jpa.JpaAccessor.translateIfNecessary(JpaAccessor.java:152)
      at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:189)
      at org.springframework.orm.jpa.JpaTemplate.executeFind(JpaTemplate.java:151)
      at org.springframework.orm.jpa.JpaTemplate.find(JpaTemplate.java:311)
      at org.apache.camel.bam.processor.ActivityMonitorEngine$1.doInTransactionWithoutResult(ActivityMonitorEngine.java:80)
      at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
      at org.apache.camel.bam.processor.ActivityMonitorEngine.run(ActivityMonitorEngine.java:77)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [1]
      at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:206)
      at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:261)
      at org.springframework.orm.jpa.JpaTemplate$9.doInJpa(JpaTemplate.java:316)
      at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:184)
      ... 7 more
      Caused by: org.hibernate.QueryParameterException: could not locate named parameter [1]
      at org.hibernate.engine.query.ParameterMetadata.getNamedParameterDescriptor(ParameterMetadata.java:99)
      at org.hibernate.engine.query.ParameterMetadata.getNamedParameterExpectedType(ParameterMetadata.java:105)
      at org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:437)
      at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:407)
      at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:201)
      ... 10 more

      Line 80

      Attachments

        1. CAMEL-2156_example.zip
          4 kB
          Karl Palsson

        Activity

          People

            davsclaus Claus Ibsen
            karlp Karl Palsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: