Codota Logo
HibernateTemplate.obtainSessionFactory
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain HibernateTemplate
private void myMethod () {
HibernateTemplate h =
  • Codota IconSessionFactory sessionFactory;new HibernateTemplate(sessionFactory)
  • Smart code suggestions by Codota
}
origin: spring-projects/spring-framework

@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
  Session session = obtainSessionFactory().getCurrentSession();
  Filter filter = session.getEnabledFilter(filterName);
  if (filter == null) {
    filter = session.enableFilter(filterName);
  }
  return filter;
}
origin: org.springframework/spring-orm

@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
  Session session = obtainSessionFactory().getCurrentSession();
  Filter filter = session.getEnabledFilter(filterName);
  if (filter == null) {
    filter = session.enableFilter(filterName);
  }
  return filter;
}
origin: spring-projects/spring-framework

boolean isNew = false;
try {
  session = obtainSessionFactory().getCurrentSession();
  session = obtainSessionFactory().openSession();
  session.setFlushMode(FlushMode.MANUAL);
  isNew = true;
origin: org.springframework/spring-orm

boolean isNew = false;
try {
  session = obtainSessionFactory().getCurrentSession();
  session = obtainSessionFactory().openSession();
  session.setFlushMode(FlushMode.MANUAL);
  isNew = true;
origin: spring-projects/spring-framework

/**
 * Prepare the given Criteria object, applying cache settings and/or
 * a transaction timeout.
 * @param criteria the Criteria object to prepare
 * @see #setCacheQueries
 * @see #setQueryCacheRegion
 */
protected void prepareCriteria(Criteria criteria) {
  if (isCacheQueries()) {
    criteria.setCacheable(true);
    if (getQueryCacheRegion() != null) {
      criteria.setCacheRegion(getQueryCacheRegion());
    }
  }
  if (getFetchSize() > 0) {
    criteria.setFetchSize(getFetchSize());
  }
  if (getMaxResults() > 0) {
    criteria.setMaxResults(getMaxResults());
  }
  ResourceHolderSupport sessionHolder =
      (ResourceHolderSupport) TransactionSynchronizationManager.getResource(obtainSessionFactory());
  if (sessionHolder != null && sessionHolder.hasTimeout()) {
    criteria.setTimeout(sessionHolder.getTimeToLiveInSeconds());
  }
}
origin: spring-projects/spring-framework

/**
 * Prepare the given Query object, applying cache settings and/or
 * a transaction timeout.
 * @param queryObject the Query object to prepare
 * @see #setCacheQueries
 * @see #setQueryCacheRegion
 */
@SuppressWarnings({"rawtypes", "deprecation"})
protected void prepareQuery(org.hibernate.Query queryObject) {
  if (isCacheQueries()) {
    queryObject.setCacheable(true);
    if (getQueryCacheRegion() != null) {
      queryObject.setCacheRegion(getQueryCacheRegion());
    }
  }
  if (getFetchSize() > 0) {
    queryObject.setFetchSize(getFetchSize());
  }
  if (getMaxResults() > 0) {
    queryObject.setMaxResults(getMaxResults());
  }
  ResourceHolderSupport sessionHolder =
      (ResourceHolderSupport) TransactionSynchronizationManager.getResource(obtainSessionFactory());
  if (sessionHolder != null && sessionHolder.hasTimeout()) {
    queryObject.setTimeout(sessionHolder.getTimeToLiveInSeconds());
  }
}
origin: org.springframework/spring-orm

/**
 * Prepare the given Query object, applying cache settings and/or
 * a transaction timeout.
 * @param queryObject the Query object to prepare
 * @see #setCacheQueries
 * @see #setQueryCacheRegion
 */
@SuppressWarnings({"rawtypes", "deprecation"})
protected void prepareQuery(org.hibernate.Query queryObject) {
  if (isCacheQueries()) {
    queryObject.setCacheable(true);
    if (getQueryCacheRegion() != null) {
      queryObject.setCacheRegion(getQueryCacheRegion());
    }
  }
  if (getFetchSize() > 0) {
    queryObject.setFetchSize(getFetchSize());
  }
  if (getMaxResults() > 0) {
    queryObject.setMaxResults(getMaxResults());
  }
  ResourceHolderSupport sessionHolder =
      (ResourceHolderSupport) TransactionSynchronizationManager.getResource(obtainSessionFactory());
  if (sessionHolder != null && sessionHolder.hasTimeout()) {
    queryObject.setTimeout(sessionHolder.getTimeToLiveInSeconds());
  }
}
origin: org.springframework/spring-orm

/**
 * Prepare the given Criteria object, applying cache settings and/or
 * a transaction timeout.
 * @param criteria the Criteria object to prepare
 * @see #setCacheQueries
 * @see #setQueryCacheRegion
 */
protected void prepareCriteria(Criteria criteria) {
  if (isCacheQueries()) {
    criteria.setCacheable(true);
    if (getQueryCacheRegion() != null) {
      criteria.setCacheRegion(getQueryCacheRegion());
    }
  }
  if (getFetchSize() > 0) {
    criteria.setFetchSize(getFetchSize());
  }
  if (getMaxResults() > 0) {
    criteria.setMaxResults(getMaxResults());
  }
  ResourceHolderSupport sessionHolder =
      (ResourceHolderSupport) TransactionSynchronizationManager.getResource(obtainSessionFactory());
  if (sessionHolder != null && sessionHolder.hasTimeout()) {
    criteria.setTimeout(sessionHolder.getTimeToLiveInSeconds());
  }
}
org.springframework.orm.hibernate5HibernateTemplateobtainSessionFactory

Javadoc

Obtain the SessionFactory for actual use.

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

  • Reading from database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • putExtra (Intent)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now