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

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

Best Java code snippets using org.springframework.orm.hibernate5.HibernateTemplate.getSessionFactory (Showing top 20 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

/**
 * Return the Hibernate SessionFactory used by this DAO.
 */
@Nullable
public final SessionFactory getSessionFactory() {
  return (this.hibernateTemplate != null ? this.hibernateTemplate.getSessionFactory() : null);
}
origin: spring-projects/spring-framework

@Override
public void afterPropertiesSet() {
  if (getSessionFactory() == null) {
    throw new IllegalArgumentException("Property 'sessionFactory' is required");
  }
}
origin: spring-projects/spring-framework

/**
 * Obtain the SessionFactory for actual use.
 * @return the SessionFactory (never {@code null})
 * @throws IllegalStateException in case of no SessionFactory set
 * @since 5.0
 */
protected final SessionFactory obtainSessionFactory() {
  SessionFactory sessionFactory = getSessionFactory();
  Assert.state(sessionFactory != null, "No SessionFactory set");
  return sessionFactory;
}
origin: spring-projects/spring-framework

/**
 * Set the Hibernate SessionFactory to be used by this DAO.
 * Will automatically create a HibernateTemplate for the given SessionFactory.
 * @see #createHibernateTemplate
 * @see #setHibernateTemplate
 */
public final void setSessionFactory(SessionFactory sessionFactory) {
  if (this.hibernateTemplate == null || sessionFactory != this.hibernateTemplate.getSessionFactory()) {
    this.hibernateTemplate = createHibernateTemplate(sessionFactory);
  }
}
origin: org.springframework/spring-orm

/**
 * Obtain the SessionFactory for actual use.
 * @return the SessionFactory (never {@code null})
 * @throws IllegalStateException in case of no SessionFactory set
 * @since 5.0
 */
protected final SessionFactory obtainSessionFactory() {
  SessionFactory sessionFactory = getSessionFactory();
  Assert.state(sessionFactory != null, "No SessionFactory set");
  return sessionFactory;
}
origin: org.springframework/spring-orm

/**
 * Return the Hibernate SessionFactory used by this DAO.
 */
@Nullable
public final SessionFactory getSessionFactory() {
  return (this.hibernateTemplate != null ? this.hibernateTemplate.getSessionFactory() : null);
}
origin: org.springframework/spring-orm

@Override
public void afterPropertiesSet() {
  if (getSessionFactory() == null) {
    throw new IllegalArgumentException("Property 'sessionFactory' is required");
  }
}
origin: org.springframework/spring-orm

/**
 * Set the Hibernate SessionFactory to be used by this DAO.
 * Will automatically create a HibernateTemplate for the given SessionFactory.
 * @see #createHibernateTemplate
 * @see #setHibernateTemplate
 */
public final void setSessionFactory(SessionFactory sessionFactory) {
  if (this.hibernateTemplate == null || sessionFactory != this.hibernateTemplate.getSessionFactory()) {
    this.hibernateTemplate = createHibernateTemplate(sessionFactory);
  }
}
origin: OpenClinica/OpenClinica

public SessionFactory getSessionFactory() {
  return hibernateTemplate.getSessionFactory();
}
origin: OpenClinica/OpenClinica

public SessionFactory getSessionFactory() {
  return hibernateTemplate.getSessionFactory();
}
origin: OpenClinica/OpenClinica

public SessionFactory getSessionFactory() {
  return hibernateTemplate.getSessionFactory();
}
origin: apache/servicemix-bundles

/**
 * Return the Hibernate SessionFactory used by this DAO.
 */
@Nullable
public final SessionFactory getSessionFactory() {
  return (this.hibernateTemplate != null ? this.hibernateTemplate.getSessionFactory() : null);
}
origin: micromata/projectforge

/**
 * Unsupported or unused keys should be deleted. This method deletes all entries with the given key.
 * 
 * @param key Key of the entries to delete.
 */
protected void deleteOldKeys(final String key)
{
 final Query query = hibernateTemplate.getSessionFactory().getCurrentSession().createQuery(
   "delete from " + UserXmlPreferencesDO.class.getSimpleName() + " where key = '" + key + "'");
 final int numberOfUpdatedEntries = query.executeUpdate();
 log.info(numberOfUpdatedEntries + " '" + key + "' entries deleted.");
}
origin: apache/servicemix-bundles

/**
 * Set the Hibernate SessionFactory to be used by this DAO.
 * Will automatically create a HibernateTemplate for the given SessionFactory.
 * @see #createHibernateTemplate
 * @see #setHibernateTemplate
 */
public final void setSessionFactory(SessionFactory sessionFactory) {
  if (this.hibernateTemplate == null || sessionFactory != this.hibernateTemplate.getSessionFactory()) {
    this.hibernateTemplate = createHibernateTemplate(sessionFactory);
  }
}
origin: micromata/projectforge

 @Override
 public void run()
 {
  final Session session = applicationContext.getBean(HibernateTemplate.class).getSessionFactory().openSession();
  final Set<String> alreadyReindexed = new HashSet<String>();
  final List<Entry> entryList = map.get(obj.getClass());
  reindexDependents(session, obj, entryList, alreadyReindexed);
  session.disconnect();
  final int size = alreadyReindexed.size();
  if (size >= 10) {
   log.info("Re-indexing of " + size + " objects done after updating " + obj.getClass().getName() + ":"
     + obj.getId());
  }
 }
}.start();
origin: micromata/projectforge

  new HibernateTransactionManager(hibernate.getSessionFactory()));
tx.execute(new TransactionCallback()
origin: micromata/projectforge

  new HibernateTransactionManager(hibernate.getSessionFactory()));
tx.execute(new TransactionCallback()
origin: micromata/projectforge

final SessionFactory sessionFactory = hibernate.getSessionFactory();
Session session = null;
boolean hasError = false;
origin: micromata/projectforge

onSaveOrModify(obj);
BaseDaoJpaAdapter.prepareInsert(obj);
Session session = hibernateTemplate.getSessionFactory().getCurrentSession();
Integer id = (Integer) session.save(obj);
log.info("New object added (" + id + "): " + obj.toString());
origin: micromata/projectforge

final SessionFactory sessionFactory = hibernate.getSessionFactory();
session = HibernateCompatUtils.openSession(sessionFactory, EmptyInterceptor.INSTANCE);
session.setFlushMode(FlushMode.AUTO);
org.springframework.orm.hibernate5HibernateTemplategetSessionFactory

Javadoc

Return the Hibernate SessionFactory that should be used to create Hibernate Sessions.

Popular methods of HibernateTemplate

  • delete
  • save
  • <init>
    Create a new HibernateTemplate instance.
  • find
  • get
  • load
  • update
  • executeWithNativeSession
    Execute the action specified by the given action object within a native Session. This execute varian
  • findByNamedParam
  • merge
  • afterPropertiesSet
  • createSessionProxy
    Create a close-suppressing proxy for the given Hibernate Session. The proxy also prepares returned Q
  • afterPropertiesSet,
  • createSessionProxy,
  • disableFilters,
  • doExecute,
  • enableFilters,
  • findByCriteria,
  • findByNamedQueryAndNamedParam,
  • getFilterNames,
  • isCheckWriteOperations

Popular in Java

  • Making http requests using okhttp
  • compareTo (BigDecimal)
  • putExtra (Intent)
  • getSystemService (Context)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Table (org.hibernate.mapping)
    A relational table
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