You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Karl Palsson (JIRA)" <ji...@apache.org> on 2009/11/11 04:07:52 UTC

[jira] Commented: (CAMEL-2156) ActivityMonitorEngine uses ?1 parameters in JPAQL, which don't work with (at least) the hibernate JPA provider.

    [ https://issues.apache.org/activemq/browse/CAMEL-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=55289#action_55289 ] 

Karl Palsson commented on CAMEL-2156:
-------------------------------------

I tried this with openJPA as well, but it gave me a slew of different errors.  I'd never used openJPA before though, so hard to say where the problem lay that way.

> ActivityMonitorEngine uses ?1 parameters in JPAQL, which don't work with (at least) the hibernate JPA provider.
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2156
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2156
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-bam
>    Affects Versions: 2.0.0
>         Environment: Spring 2.5.6, camel 2.0.0, hibernate 3.3.2.GA/3.4.0GA
>            Reporter: Karl Palsson
>         Attachments: CAMEL-2156_example.zip
>
>
> 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

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