javax.persistence.Query.getHints()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(534)

本文整理了Java中javax.persistence.Query.getHints方法的一些代码示例,展示了Query.getHints的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getHints方法的具体详情如下:
包路径:javax.persistence.Query
类名称:Query
方法名:getHints

Query.getHints介绍

[英]Get the properties and hints and associated values that are in effect for the query instance.
[中]获取对查询实例有效的属性、提示和关联值。

代码示例

代码示例来源:origin: Impetus/Kundera

@Override
public Map<String, Object> getHints()
{
  return query.getHints();
}

代码示例来源:origin: de.mhus.lib/mhu-lib-persistence

/** {@inheritDoc} */
@Override
public Map<String, Object> getHints() {
  return query.getHints();
}

代码示例来源:origin: org.evolvis.bsi/kolab-ws

@Override
public Map<String, Object>
getHints()
{
  return delegate.getHints();
}

代码示例来源:origin: org.jboss.eap/wildfly-jpa

@Override
public Map<String, Object> getHints() {
  return underlyingQuery.getHints();
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-persistence-jpa20

@Override
public Map<String, Object> getHints() {
  return query.getHints();
}

代码示例来源:origin: kumuluz/kumuluzee

@Override
public Map<String, Object> getHints() {
  return query.getHints();
}

代码示例来源:origin: com.kumuluz.ee/kumuluzee-jpa-common

@Override
public Map<String, Object> getHints() {
  return query.getHints();
}

代码示例来源:origin: org.wildfly/wildfly-jpa

@Override
public Map<String, Object> getHints() {
  return underlyingQuery.getHints();
}

代码示例来源:origin: org.apache.openejb/openejb-core

public Map<String, Object> getHints() {
  return query.getHints();
}

代码示例来源:origin: org.apache.tomee/openejb-core

public Map<String, Object> getHints() {
  return query.getHints();
}

代码示例来源:origin: jaxio/jpa-query-by-example

/**
 * 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;
}

代码示例来源:origin: jaxio/generated-projects

/**
 * 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;
}

代码示例来源:origin: jaxio/jpa-query-by-example

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;
  }
}

代码示例来源:origin: jaxio/generated-projects

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;
  }
}

代码示例来源:origin: org.glassfish.main.common/container-common

public Map<String, Object> getHints() {
  try {
    if(callFlowAgent.isEnabled()) {
      callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.GET_HINTS);
    }
    return queryDelegate.getHints();
  } finally {
    if(callFlowAgent.isEnabled()) {
      callFlowAgent.entityManagerQueryEnd();
    }
  }
}

代码示例来源:origin: org.glassfish.common/container-common

public Map<String, Object> getHints() {
  try {
    if(callFlowAgent.isEnabled()) {
      callFlowAgent.entityManagerQueryStart(EntityManagerQueryMethod.GET_HINTS);
    }
    Query delegate = getQueryDelegate();
    return delegate.getHints();
  } finally {
    if(callFlowAgent.isEnabled()) {
      callFlowAgent.entityManagerQueryEnd();
    }
  }
}

代码示例来源:origin: com.mysema.querydsl/querydsl-jpa

@Test
@NoEclipseLink @NoOpenJPA
public void Hint() {
  javax.persistence.Query query = query().from(cat)
      .setHint("org.hibernate.cacheable", true)
      .createQuery(cat);
  assertNotNull(query);
  assertTrue(query.getHints().containsKey("org.hibernate.cacheable"));
  assertFalse(query.getResultList().isEmpty());
}

代码示例来源:origin: com.querydsl/querydsl-jpa

@Test
@NoEclipseLink @NoOpenJPA
public void hint() {
  javax.persistence.Query query = query().from(cat)
      .setHint("org.hibernate.cacheable", true)
      .select(cat).createQuery();
  assertNotNull(query);
  assertTrue(query.getHints().containsKey("org.hibernate.cacheable"));
  assertFalse(query.getResultList().isEmpty());
}

代码示例来源:origin: com.mysema.querydsl/querydsl-jpa

@Test @Ignore
@NoHibernate @NoOpenJPA @NoBatooJPA
public void Hint3() {
  javax.persistence.Query query = query().from(cat)
      .setHint("eclipselink.batch.type", "IN")
      .setHint("eclipselink.batch", "person.workAddress")
      .setHint("eclipselink.batch", "person.homeAddress")
      .createQuery(cat);
  assertNotNull(query);
  assertEquals("person.homeAddress", query.getHints().get("eclipselink.batch"));
}

代码示例来源:origin: com.querydsl/querydsl-jpa

@Test @Ignore
@NoHibernate @NoOpenJPA @NoBatooJPA
public void hint3() {
  javax.persistence.Query query = query().from(cat)
      .setHint("eclipselink.batch.type", "IN")
      .setHint("eclipselink.batch", "person.workAddress")
      .setHint("eclipselink.batch", "person.homeAddress")
      .select(cat).createQuery();
  assertNotNull(query);
  assertEquals("person.homeAddress", query.getHints().get("eclipselink.batch"));
}

相关文章