コード例 #1
0
 public void testHintsAreProcessed() {
   Query q = em.createNamedQuery("SQLWithHints");
   assertEquals(QueryLanguages.LANG_SQL, OpenJPAPersistence.cast(q).getLanguage());
   String hintKey = "XYZ";
   assertTrue(q.getHints().containsKey(hintKey));
   assertEquals("abc", q.getHints().get(hintKey));
 }
コード例 #2
0
 private Query recreateQuery(Query current, String newSqlString) {
   Query result = entityManager.createQuery(newSqlString);
   for (Entry<String, Object> hint : current.getHints().entrySet()) {
     result.setHint(hint.getKey(), hint.getValue());
   }
   return result;
 }
コード例 #3
0
 private Query recreateQuery(Query current, String newSqlString) {
   Query result = entityManager.createQuery(newSqlString);
   Map<String, Object> hints = current.getHints();
   for (String hintName : hints.keySet()) {
     result.setHint(hintName, hints.get(hintName));
   }
   return result;
 }
コード例 #4
0
 /**
  * If the named query has the "query" hint, it uses the hint value (which must be jpa QL) to
  * create a new query and append to it the proper order by clause.
  */
 private String getQueryString(Query query) {
   Map<String, Object> hints = query.getHints();
   return hints != null ? (String) hints.get("query") : null;
 }