2 Replies Latest reply on Jul 1, 2014 11:28 AM by ratnadinakar

    Selecting Entity using JPA Named Query In Switchyard

    ratnadinakar Newbie

      Hi,

       

      I'm trying to select an entity using JPA named query. I'm getting the below exception

       

      [org.apache.camel.impl.DefaultPollingConsumerPollStrategy] (Camel (camel-1) thread #1 -

      jpa://app.inventory.Person) Consumer Consumer[jpa://app.inventory.Person?consumeDelete=false&consumeLockEntity=false&consumer.namedQuery=Person.findByPersonalCode&consumer.tansacted=true&maxMessagesPerPoll=0&maximumResults=1&persistenceUnit=Person&transactionManager=%23jtaTransactionManager]

      could not poll endpoint: Endpoint[jpa://app.inventory.Person?consumeDelete=false&consumeLockEntity=false&consumer.namedQuery=Person.findByPersonalCode&consumer.transacted=truemaxMessagesPerPoll=0&maximumResults=1&persistenceUnit=Person&transactionManager=%23jtaTransactionManager]

      caused by: org.hibernate.QueryException: Not all namd parameters have been set: [1] [FROM Person p WHERE p.personalCode= ?1];

      nested exception is java.lang.IllegalArgumentException: org.hibernate.QueryException

      Not all named parameters have been set: [1] [FROM Person p WHERE p.personalCode= ?1]:

      org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.QueryException: Not all named parameters have been set: [1]

      [FROM Person p WHERE p.personalCode= ?1]; nested exception is java.lang.IllegalArgumentException org.hibernate.QueryException: Not all named parameters have been set: [1] [FROM Person p WHERE p.personalCode= ?1]

       

      I tried using consume.parameters option which I'm unable to set in switchyard.

       

      Any Example for selecting entities using named queries would be appreciated.