Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.HibernateTransactionManager


    filter2.init(filterConfig2);

    final FilterChain filterChain = new FilterChain() {
      @Override
      public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) {
        HibernateTransactionManager tm = new HibernateTransactionManager(sf);
        TransactionStatus ts = tm.getTransaction(
            new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_SUPPORTS));
        org.hibernate.Session sess = SessionFactoryUtils.getSession(sf, true);
        SessionFactoryUtils.releaseSession(sess, sf);
        tm.commit(ts);
        servletRequest.setAttribute("invoked", Boolean.TRUE);
      }
    };

    FilterChain filterChain2 = new FilterChain() {
View Full Code Here


    @Bean
    @Autowired
    public HibernateTransactionManager transactionManager(SessionFactory sessionFactory)
    {
        HibernateTransactionManager htm = new HibernateTransactionManager();
        htm.setSessionFactory(sessionFactory);
        return htm;
    }
View Full Code Here

  @SuppressWarnings({ "rawtypes", "unchecked"})
  private void reindex(final Class< ? > clazz, final ReindexSettings settings, final StringBuffer buf)
  {
    // PF-378: Performance of run of full re-indexing the data-base is very slow for large data-bases
    // Single transactions needed, otherwise the full run will be very slow for large data-bases.
    final TransactionTemplate tx = new TransactionTemplate(new HibernateTransactionManager(hibernate.getSessionFactory()));
    tx.execute(new TransactionCallback() {
      // The call-back is needed, otherwise a lot of transactions are left open until last run is completed:
      public Object doInTransaction(final TransactionStatus status)
      {
        try {
View Full Code Here

   * @param includeHistory bei false werden die History Einträge nicht geschrieben
   * @param preserveIds If true, the object ids will be preserved, otherwise new ids will be assigned through xstream.
   */
  public void dumpDatabaseToXml(final Writer writer, final boolean includeHistory, final boolean preserveIds)
  {
    final TransactionTemplate tx = new TransactionTemplate(new HibernateTransactionManager(hibernate.getSessionFactory()));
    tx.execute(new TransactionCallback() {
      public Object doInTransaction(final TransactionStatus status)
      {
        hibernate.execute(new HibernateCallback() {
          public Object doInHibernate(final Session session) throws HibernateException
View Full Code Here

    return bean;
  }

  @Bean
  public HibernateTransactionManager transactionManager() {
    return new HibernateTransactionManager( sessionFactoryBean().getObject() );
  }
View Full Code Here

  public static void main(String[] args) {
    setupContext();
    DoSQL me = new DoSQL();
    String sql = join(args, " ");
   
    HibernateTransactionManager htm = ContextManager.getTransactionManager();
    TransactionDefinition transDef = new DefaultTransactionDefinition();
    TransactionStatus transStatus = htm.getTransaction(transDef);
    SessionFactory sf = ContextManager.getSessionFactory();
    Session sess = sf.getCurrentSession();
    SQLQuery q = sess.createSQLQuery(sql);
    q.executeUpdate();
    sess.flush();
View Full Code Here

        return sessionFactory();
    }

    @Bean
    public HibernateTransactionManager transactionManager() {
        return new HibernateTransactionManager( sessionFactoryBean().getObject() );
    }
View Full Code Here

    }

    @Bean
    @Autowired
    public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) {
        final HibernateTransactionManager txManager = new HibernateTransactionManager();
        txManager.setSessionFactory(sessionFactory);

        return txManager;
    }
View Full Code Here

  protected PlatformTransactionManager createTransactionManager(SessionFactory hibernateSessionFactory) {
    AbstractPlatformTransactionManager newTransMgr;
    if (hibernateSessionFactory == null) {
      newTransMgr = new DataSourceTransactionManager(getDataSource());
    } else {
      newTransMgr = new HibernateTransactionManager(hibernateSessionFactory);
    }
    newTransMgr.setNestedTransactionAllowed(true);
    return newTransMgr;
  }
View Full Code Here

  protected PlatformTransactionManager createTransactionManager(SessionFactory sessionFactory) {
    PlatformTransactionManager transMgr = getTransactionManager();
    if (transMgr == null) {
      AbstractPlatformTransactionManager newTransMgr;
      if (sessionFactory != null) {
        newTransMgr = new HibernateTransactionManager(sessionFactory);
      } else {
        newTransMgr = new DataSourceTransactionManager(getDataSource());
      }
      newTransMgr.setNestedTransactionAllowed(true);
      transMgr = newTransMgr;
View Full Code Here

TOP

Related Classes of org.springframework.orm.hibernate3.HibernateTransactionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.