Tabnine Logo
HibernateTemplate.prepareQuery
Code IndexAdd Tabnine to your IDE (free)

How to use
prepareQuery
method
in
org.springframework.orm.hibernate5.HibernateTemplate

Best Java code snippets using org.springframework.orm.hibernate5.HibernateTemplate.prepareQuery (Showing top 19 results out of 315)

origin: spring-projects/spring-framework

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> find(final String queryString, @Nullable final Object... values) throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        queryObject.setParameter(i, values[i]);
      }
    }
    return queryObject.list();
  }));
}
origin: spring-projects/spring-framework

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByNamedQuery(final String queryName, @Nullable final Object... values) throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(getNamedQueryMethod, session, queryName));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        queryObject.setParameter(i, values[i]);
      }
    }
    return queryObject.list();
  }));
}
origin: spring-projects/spring-framework

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "deprecation"})
public int bulkUpdate(final String queryString, @Nullable final Object... values) throws DataAccessException {
  Integer result = executeWithNativeSession(session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        queryObject.setParameter(i, values[i]);
      }
    }
    return queryObject.executeUpdate();
  });
  Assert.state(result != null, "No update count");
  return result;
}
origin: spring-projects/spring-framework

prepareQuery(((org.hibernate.Query) retVal));
origin: spring-projects/spring-framework

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByValueBean(final String queryString, final Object valueBean)
    throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    queryObject.setProperties(valueBean);
    return queryObject.list();
  }));
}
origin: spring-projects/spring-framework

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByNamedQueryAndNamedParam(
    final String queryName, @Nullable final String[] paramNames, @Nullable final Object[] values)
    throws DataAccessException {
  if (values != null && (paramNames == null || paramNames.length != values.length)) {
    throw new IllegalArgumentException("Length of paramNames array must match length of values array");
  }
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = (org.hibernate.Query)
        nonNull(ReflectionUtils.invokeMethod(getNamedQueryMethod, session, queryName));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        applyNamedParameterToQuery(queryObject, paramNames[i], values[i]);
      }
    }
    return queryObject.list();
  }));
}
origin: spring-projects/spring-framework

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByNamedQueryAndValueBean(final String queryName, final Object valueBean)
    throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(getNamedQueryMethod, session, queryName));
    prepareQuery(queryObject);
    queryObject.setProperties(valueBean);
    return queryObject.list();
  }));
}
origin: spring-projects/spring-framework

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "deprecation"})
public Iterator<?> iterate(final String queryString, @Nullable final Object... values) throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<Iterator<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        queryObject.setParameter(i, values[i]);
      }
    }
    return queryObject.iterate();
  }));
}
origin: spring-projects/spring-framework

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByNamedParam(final String queryString, final String[] paramNames, final Object[] values)
    throws DataAccessException {
  if (paramNames.length != values.length) {
    throw new IllegalArgumentException("Length of paramNames array must match length of values array");
  }
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    for (int i = 0; i < values.length; i++) {
      applyNamedParameterToQuery(queryObject, paramNames[i], values[i]);
    }
    return queryObject.list();
  }));
}
origin: org.springframework/spring-orm

prepareQuery(((org.hibernate.Query) retVal));
origin: org.springframework/spring-orm

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> find(final String queryString, @Nullable final Object... values) throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        queryObject.setParameter(i, values[i]);
      }
    }
    return queryObject.list();
  }));
}
origin: org.springframework/spring-orm

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByNamedQuery(final String queryName, @Nullable final Object... values) throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(getNamedQueryMethod, session, queryName));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        queryObject.setParameter(i, values[i]);
      }
    }
    return queryObject.list();
  }));
}
origin: org.springframework/spring-orm

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "deprecation"})
public int bulkUpdate(final String queryString, @Nullable final Object... values) throws DataAccessException {
  Integer result = executeWithNativeSession(session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        queryObject.setParameter(i, values[i]);
      }
    }
    return queryObject.executeUpdate();
  });
  Assert.state(result != null, "No update count");
  return result;
}
origin: org.springframework/spring-orm

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByValueBean(final String queryString, final Object valueBean)
    throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    queryObject.setProperties(valueBean);
    return queryObject.list();
  }));
}
origin: org.springframework/spring-orm

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "deprecation"})
public Iterator<?> iterate(final String queryString, @Nullable final Object... values) throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<Iterator<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        queryObject.setParameter(i, values[i]);
      }
    }
    return queryObject.iterate();
  }));
}
origin: org.springframework/spring-orm

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByNamedQueryAndValueBean(final String queryName, final Object valueBean)
    throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(getNamedQueryMethod, session, queryName));
    prepareQuery(queryObject);
    queryObject.setProperties(valueBean);
    return queryObject.list();
  }));
}
origin: org.springframework/spring-orm

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByNamedQueryAndNamedParam(
    final String queryName, @Nullable final String[] paramNames, @Nullable final Object[] values)
    throws DataAccessException {
  if (values != null && (paramNames == null || paramNames.length != values.length)) {
    throw new IllegalArgumentException("Length of paramNames array must match length of values array");
  }
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = (org.hibernate.Query)
        nonNull(ReflectionUtils.invokeMethod(getNamedQueryMethod, session, queryName));
    prepareQuery(queryObject);
    if (values != null) {
      for (int i = 0; i < values.length; i++) {
        applyNamedParameterToQuery(queryObject, paramNames[i], values[i]);
      }
    }
    return queryObject.list();
  }));
}
origin: org.springframework/spring-orm

@Deprecated
@Override
@SuppressWarnings({"rawtypes", "unchecked", "deprecation"})
public List<?> findByNamedParam(final String queryString, final String[] paramNames, final Object[] values)
    throws DataAccessException {
  if (paramNames.length != values.length) {
    throw new IllegalArgumentException("Length of paramNames array must match length of values array");
  }
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    org.hibernate.Query queryObject = queryObject(
        ReflectionUtils.invokeMethod(createQueryMethod, session, queryString));
    prepareQuery(queryObject);
    for (int i = 0; i < values.length; i++) {
      applyNamedParameterToQuery(queryObject, paramNames[i], values[i]);
    }
    return queryObject.list();
  }));
}
origin: apache/servicemix-bundles

prepareQuery(((org.hibernate.Query) retVal));
org.springframework.orm.hibernate5HibernateTemplateprepareQuery

Javadoc

Prepare the given Query object, applying cache settings and/or a transaction timeout.

Popular methods of HibernateTemplate

  • delete
  • save
  • <init>
    Create a new HibernateTemplate instance.
  • find
  • get
  • load
  • update
  • getSessionFactory
    Return the Hibernate SessionFactory that should be used to create Hibernate Sessions.
  • executeWithNativeSession
    Execute the action specified by the given action object within a native Session. This execute varian
  • findByNamedParam
  • merge
  • afterPropertiesSet
  • merge,
  • afterPropertiesSet,
  • createSessionProxy,
  • disableFilters,
  • doExecute,
  • enableFilters,
  • findByCriteria,
  • findByNamedQueryAndNamedParam,
  • getFilterNames,
  • isCheckWriteOperations

Popular in Java

  • Reactive rest calls using spring rest template
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • setScale (BigDecimal)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JPanel (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now