Hitachi

uCosminexus Application Server Compatibility Guide


9.17.9 Notes on using JPQL

This section describes the notes on using JPQL.

Organization of this subsection

(1) Notes on the null value

(2) Notes on using JPQL in HiRDB

The examples of coding queries that cannot be used when JPQL is used in HiRDB are as follows:

Example 1 of query that cannot be used: Specifying a location parameter in the function argument
Query query1 = em.createQuery(
"SELECT  o FROM TestEntity o "+
                "WHERE o.name=TRIM(LEADING FROM ?1)")
              .setParameter(1, "  HitachiTaro");
Example 2 of query that cannot be used: Specifying a location parameter in the four arithmetic operators
int no_A=2;
int no_B=4;
Query query2 = em.createQuery(
"SELECT  o FROM TestEntity o WHERE o.id = ?1 + ?2")
               .setParameter(1, no_A)
               .setParameter(2, no_B);
Example 3 of query that cannot be used: Specifying a location parameter in the comparison operators
int cmp_no=3;
Query query3 = em.createQuery(
"SELECT  o FROM TestEntity o WHERE o.id = ?1 AND ?1 < 9")
               .setParameter(1, cmp_no);