Refine search
public QueryHintDefinition(final QueryHint[] hints) { if ( hints == null || hints.length == 0 ) { hintsMap = Collections.emptyMap(); } else { final Map<String, Object> hintsMap = new HashMap<String, Object>(); for ( QueryHint hint : hints ) { hintsMap.put( hint.name(), hint.value() ); } this.hintsMap = hintsMap; } }
@NamedQuery( name = "product_by_name", query = "select p from Product p where p.name is not null", lockMode = LockModeType.PESSIMISTIC_WRITE, hints = @QueryHint(name = QueryHints.FOLLOW_ON_LOCKING, value = "true") ) @Entity(name = "Product") public static class Product { @Id @GeneratedValue private Long id; private String name; }
private static Map<String, Object> findQueryHints(Method method) { Map<String, Object> queryHints = new HashMap<String, Object>(); QueryHints queryHintsAnnotation = AnnotatedElementUtils.findMergedAnnotation(method, QueryHints.class); if (queryHintsAnnotation != null) { for (QueryHint hint : queryHintsAnnotation.value()) { queryHints.put(hint.name(), hint.value()); } } QueryHint queryHintAnnotation = AnnotationUtils.findAnnotation(method, QueryHint.class); if (queryHintAnnotation != null) { queryHints.put(queryHintAnnotation.name(), queryHintAnnotation.value()); } return Collections.unmodifiableMap(queryHints); }
@QueryHints({@QueryHint(name = org.hibernate.jpa.QueryHints.HINT_CACHEABLE, value = "true")}) Account findByAccessToken(String accessToken); }
@QueryHints({@QueryHint(name = org.hibernate.jpa.QueryHints.HINT_CACHEABLE, value = "true")}) ConfigProperty findByPropKey(String propKey); }
private static Map<String, Object> findQueryHints(Method method) { Map<String, Object> queryHints = new HashMap<String, Object>(); QueryHints queryHintsAnnotation = AnnotatedElementUtils.findMergedAnnotation(method, QueryHints.class); if (queryHintsAnnotation != null) { for (QueryHint hint : queryHintsAnnotation.value()) { queryHints.put(hint.name(), hint.value()); } } QueryHint queryHintAnnotation = AnnotationUtils.findAnnotation(method, QueryHint.class); if (queryHintAnnotation != null) { queryHints.put(queryHintAnnotation.name(), queryHintAnnotation.value()); } return Collections.unmodifiableMap(queryHints); }
/** * Protected to be able to customize in sub-classes. * * @param query must not be {@literal null}. * @param hint must not be {@literal null}. */ protected <T extends Query> void applyQueryHint(T query, QueryHint hint) { Assert.notNull(query, "Query must not be null!"); Assert.notNull(hint, "QueryHint must not be null!"); query.setHint(hint.name(), hint.value()); }
@QueryHints({ @QueryHint(name = org.hibernate.jpa.QueryHints.HINT_CACHEABLE, value = "true") }) JobBeanCfg findByJobClass(String jobClass); }
private static Map<String, Object> findQueryHints(Method method) { Map<String, Object> queryHints = new HashMap<String, Object>(); QueryHints queryHintsAnnotation = AnnotatedElementUtils.findMergedAnnotation(method, QueryHints.class); if (queryHintsAnnotation != null) { for (QueryHint hint : queryHintsAnnotation.value()) { queryHints.put(hint.name(), hint.value()); } } QueryHint queryHintAnnotation = AnnotationUtils.findAnnotation(method, QueryHint.class); if (queryHintAnnotation != null) { queryHints.put(queryHintAnnotation.name(), queryHintAnnotation.value()); } return Collections.unmodifiableMap(queryHints); }
@NamedNativeQuery(name = "NumValue.getSomeValues", query = "{ ? = call f_test_return_cursor() }", resultClass = NumValue.class, hints = { @QueryHint(name = "org.hibernate.callable", value = "true") }) }) public class NumValue implements Serializable {
/** * Prepare any {@link QueryHint} declarations * * @param constantPool * @param queryHints * @param hint */ protected void prepareQueryHints(ConstPool constantPool, List<AnnotationMemberValue> queryHints, QueryHint hint) { Annotation queryHint = new Annotation(QueryHint.class.getName(), constantPool); StringMemberValue hintName = new StringMemberValue(constantPool); hintName.setValue(hint.name()); queryHint.addMemberValue("name", hintName); StringMemberValue hintValue = new StringMemberValue(constantPool); hintValue.setValue(hint.value()); queryHint.addMemberValue("value", hintValue); AnnotationMemberValue hintAnnotation = new AnnotationMemberValue(queryHint, constantPool); queryHints.add(hintAnnotation); } }
@QueryHints({@QueryHint(name = org.hibernate.jpa.QueryHints.HINT_CACHEABLE, value = "true")}) OauthAccount findByAccountAndOauthOpenIdAndOauthTypeAndAuthType(Account account, String oauthOpenId, GlobalConstant.OauthTypeEnum oauthType, Account.AuthTypeEnum authType); }
private static Map<String, Object> findQueryHints(Method method) { Map<String, Object> queryHints = new HashMap<String, Object>(); QueryHints queryHintsAnnotation = AnnotatedElementUtils.findMergedAnnotation(method, QueryHints.class); if (queryHintsAnnotation != null) { for (QueryHint hint : queryHintsAnnotation.value()) { queryHints.put(hint.name(), hint.value()); } } QueryHint queryHintAnnotation = AnnotationUtils.findAnnotation(method, QueryHint.class); if (queryHintAnnotation != null) { queryHints.put(queryHintAnnotation.name(), queryHintAnnotation.value()); } return Collections.unmodifiableMap(queryHints); }
lockMode = LockModeType.PESSIMISTIC_WRITE, hints = { @QueryHint(name = QueryHints.TIMEOUT_JPA, value = "3000"), @QueryHint(name = QueryHints.CACHE_MODE, value = "ignore"), @QueryHint(name = QueryHints.CACHEABLE, value = "true"), @QueryHint(name = QueryHints.READ_ONLY, value = "true"), @QueryHint(name = QueryHints.COMMENT, value = "custom static comment"), @QueryHint(name = QueryHints.FETCH_SIZE, value = "512"), @QueryHint(name = QueryHints.FLUSH_MODE, value = "manual")
@QueryHints({@QueryHint(name = org.hibernate.jpa.QueryHints.HINT_CACHEABLE, value = "true")}) DemoSiteUser findByAccount(Account account); }
query = "select p from Person p where name = :name", hints = { @QueryHint( name = "org.hibernate.readOnly", value = "true"
private static Integer getInteger(String query, String hintName, QueryHint[] hints) { for (QueryHint hint : hints) { if ( hintName.equals( hint.name() ) ) { try { return Integer.decode( hint.value() ); } catch (NumberFormatException nfe) { throw new AnnotationException( "Not an integer in hint: " + query + ":" + hint.name(), nfe ); } } } return null; }
@QueryHints({@QueryHint(name = org.hibernate.jpa.QueryHints.HINT_CACHEABLE, value = "true")}) List<DistrictData> findAllByOrderByIdAsc(); }
name = "findUserRangeNamedNullPassing", procedureName = "findUserRange", hints = @QueryHint( name = "hibernate.proc.param_null_passing.firstArg", value = "true" ), parameters = { @StoredProcedureParameter( name = "firstArg", type = Integer.class ), name = "findUserRangeOrdinalNullPassing", procedureName = "findUserRange", hints = @QueryHint( name = "hibernate.proc.param_null_passing.1", value = "true" ), parameters = { @StoredProcedureParameter( type = Integer.class ),