Hi Guys

i tried these method for some reason i am not getting the expected
results.... has any one tried these methods? i have the following named
query...

SELECT x FROM Magazine x, IN(x.articles) y WHERE y.authorName = :personName,
when i use the getNamedParameters on the it returns an empty map...


           Query query = em.createNamedQuery(jpql);
           OpenJPAQuery jpaQuery = OpenJPAPersistence.cast(query);
           if (jpaQuery.hasPositionalParameters())
               throw new QueryException(
                       "The query does not has named parameters please
check your arguments");

           Map namedParamMap = (Map) jpaQuery.getNamedParameters();


in this case, based on the documentation, should expect a map with one
entry.. but for some reason i am getting null map..

same for the positional args
SELECT x FROM Magazine x, IN(x.articles) y WHERE y.authorName = ?1, when i
use the getPositionalParameters on the it returns an empty map...

          Query query = em.createNamedQuery(jpql);
           OpenJPAQuery jpaQuery = OpenJPAPersistence.cast(query);
           jpaQuery.compile();
           if (!jpaQuery.hasPositionalParameters())
               throw new QueryException(
                       "The query does not has positional parameters please
check your arguments");
           Object[] positionParamArray = (Object[]) jpaQuery
                   .getPositionalParameters();


I am not sure if my understanding is wrong or the methods are not behaving
appropriately...

Reply via email to