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

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

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

origin: spring-projects/spring-framework

@Override
public Serializable save(final String entityName, final Object entity) throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    checkWriteOperationAllowed(session);
    return session.save(entityName, entity);
  }));
}
origin: spring-projects/spring-framework

@Override
public Serializable save(final Object entity) throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    checkWriteOperationAllowed(session);
    return session.save(entity);
  }));
}
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<?> 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

@Override
@SuppressWarnings({"unchecked", "deprecation"})
public <T> List<T> loadAll(final Class<T> entityClass) throws DataAccessException {
  return nonNull(executeWithNativeSession((HibernateCallback<List<T>>) session -> {
    Criteria criteria = session.createCriteria(entityClass);
    criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
    prepareCriteria(criteria);
    return criteria.list();
  }));
}
origin: spring-projects/spring-framework

@Override
@SuppressWarnings({"unchecked", "deprecation"})
public <T> List<T> findByExample(
    @Nullable final String entityName, final T exampleEntity, final int firstResult, final int maxResults)
    throws DataAccessException {
  Assert.notNull(exampleEntity, "Example entity must not be null");
  return nonNull(executeWithNativeSession((HibernateCallback<List<T>>) session -> {
    Criteria executableCriteria = (entityName != null ?
        session.createCriteria(entityName) : session.createCriteria(exampleEntity.getClass()));
    executableCriteria.add(Example.create(exampleEntity));
    prepareCriteria(executableCriteria);
    if (firstResult >= 0) {
      executableCriteria.setFirstResult(firstResult);
    }
    if (maxResults > 0) {
      executableCriteria.setMaxResults(maxResults);
    }
    return executableCriteria.list();
  }));
}
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<?> 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

@Override
public Object load(final String entityName, final Serializable id, @Nullable final LockMode lockMode)
    throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    if (lockMode != null) {
      return session.load(entityName, id, new LockOptions(lockMode));
    }
    else {
      return session.load(entityName, id);
    }
  }));
}
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: spring-projects/spring-framework

@Override
public <T> T load(final Class<T> entityClass, final Serializable id, @Nullable final LockMode lockMode)
    throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    if (lockMode != null) {
      return session.load(entityClass, id, new LockOptions(lockMode));
    }
    else {
      return session.load(entityClass, id);
    }
  }));
}
origin: spring-projects/spring-framework

@Override
@SuppressWarnings("unchecked")
public <T> T merge(final T entity) throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    checkWriteOperationAllowed(session);
    return (T) session.merge(entity);
  }));
}
origin: spring-projects/spring-framework

@Override
@SuppressWarnings("unchecked")
public <T> T merge(final String entityName, final T entity) throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    checkWriteOperationAllowed(session);
    return (T) session.merge(entityName, entity);
  }));
}
origin: spring-projects/spring-framework

@Override
@SuppressWarnings("unchecked")
public List<?> findByCriteria(final DetachedCriteria criteria, final int firstResult, final int maxResults)
    throws DataAccessException {
  Assert.notNull(criteria, "DetachedCriteria must not be null");
  return nonNull(executeWithNativeSession((HibernateCallback<List<?>>) session -> {
    Criteria executableCriteria = criteria.getExecutableCriteria(session);
    prepareCriteria(executableCriteria);
    if (firstResult >= 0) {
      executableCriteria.setFirstResult(firstResult);
    }
    if (maxResults > 0) {
      executableCriteria.setMaxResults(maxResults);
    }
    return executableCriteria.list();
  }));
}
origin: org.springframework/spring-orm

@Override
public Object load(final String entityName, final Serializable id, @Nullable final LockMode lockMode)
    throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    if (lockMode != null) {
      return session.load(entityName, id, new LockOptions(lockMode));
    }
    else {
      return session.load(entityName, id);
    }
  }));
}
origin: org.springframework/spring-orm

@Override
@SuppressWarnings("unchecked")
public <T> T merge(final T entity) throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    checkWriteOperationAllowed(session);
    return (T) session.merge(entity);
  }));
}
origin: org.springframework/spring-orm

@Override
@SuppressWarnings("unchecked")
public <T> T merge(final String entityName, final T entity) throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    checkWriteOperationAllowed(session);
    return (T) session.merge(entityName, entity);
  }));
}
origin: org.springframework/spring-orm

@Override
public <T> T load(final Class<T> entityClass, final Serializable id, @Nullable final LockMode lockMode)
    throws DataAccessException {
  return nonNull(executeWithNativeSession(session -> {
    if (lockMode != null) {
      return session.load(entityClass, id, new LockOptions(lockMode));
    }
    else {
      return session.load(entityClass, id);
    }
  }));
}
org.springframework.orm.hibernate5HibernateTemplatenonNull

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

  • Making http requests using okhttp
  • putExtra (Intent)
  • onRequestPermissionsResult (Fragment)
  • onCreateOptionsMenu (Activity)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • String (java.lang)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • CodeWhisperer alternatives
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