Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.HibernateTransactionManager


        AnnotationSessionFactoryBean sessionFactory = new AnnotationSessionFactoryBean();
        sessionFactory.setDataSource(dataSource);
        sessionFactory.setAnnotatedClasses(new Class[] {PhotoSpot.class});
        sessionFactory.afterPropertiesSet();

        repo.hibernate = new HibernateTemplate(sessionFactory.getObject());
    }
View Full Code Here


  public Hibernate3UserDao() {
    super();
  }

  public void setSessionFactory(SessionFactory sessionFactory) {
    this.hibernateTemplate = new HibernateTemplate(sessionFactory, true);
  }
View Full Code Here

      if (hibernateTemplate != null)
        logger.debug("hibernateTemplate present - jBPM persistence service will be managed by Spring");
      else {
        if (dummy.getSessionFactory() != null) {
          logger.debug("creating hibernateTemplate based on jBPM SessionFactory");
          hibernateTemplate = new HibernateTemplate(dummy.getSessionFactory());
        }
        else

          logger.debug("hibernateTemplate missing - jBPM will handle its own persistence");
      }
View Full Code Here

   */
  public void afterPropertiesSet() {
    if (jbpmSessionFactory == null)
      throw new IllegalArgumentException("jbpmSessionFactory must be set");
    // init the hbTemplate that will be used to prepare and handle the HB Session
    hibernateTemplate = new HibernateTemplate(jbpmSessionFactory.getSessionFactory());
    hibernateTemplate.setAllowCreate(allowCreate);
  }
View Full Code Here

    DataSource dataSource = getDataSource();
    populateDataBase(dataSource);
    sessionFactory = getSessionFactory(dataSource);
    hibernateTemplate = new HibernateTemplate(sessionFactory);
    hibernateTemplate.setCheckWriteOperations(false);
    HibernateTransactionManager tm = new HibernateTransactionManager(sessionFactory);
    hibernateListener = new HibernateFlowExecutionListener(sessionFactory, tm);

    ClassPathResource res = new ClassPathResource("flow-managed-persistence.xml", getClass());
    DefaultFlowModelHolder holder = new DefaultFlowModelHolder(new XmlFlowModelBuilder(res));
    FlowModelFlowBuilder builder = new FlowModelFlowBuilder(holder);
View Full Code Here

    populateDataBase(dataSource);
    jdbcTemplate = new JdbcTemplate(dataSource);
    sessionFactory = getSessionFactory(dataSource);
    hibernateTemplate = new HibernateTemplate(sessionFactory);
    hibernateTemplate.setCheckWriteOperations(false);
    HibernateTransactionManager tm = new HibernateTransactionManager(sessionFactory);
    hibernateListener = new HibernateFlowExecutionListener(sessionFactory, tm);
  }
View Full Code Here

    final OpenSessionInViewFilter filter2 = new OpenSessionInViewFilter();
    filter2.init(filterConfig2);

    final FilterChain filterChain = new FilterChain() {
      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);

        sessionControl.verify();
        sessionControl.reset();

        session.close();
        sessionControl.setReturnValue(null, 1);
        sessionControl.replay();

        servletRequest.setAttribute("invoked", Boolean.TRUE);
      }
    };

    final FilterChain filterChain2 = new FilterChain() {
      public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
          throws IOException, ServletException {

        HibernateTransactionManager tm = new HibernateTransactionManager(sf2);
        TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
        tm.commit(ts);

        session2Control.verify();
        session2Control.reset();

        session2.close();
View Full Code Here

    final OpenSessionInViewFilter filter2 = new OpenSessionInViewFilter();
    filter2.init(filterConfig2);

    final FilterChain filterChain = new FilterChain() {
      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);

        sessionControl.verify();
        sessionControl.reset();
        try {
          session.close();
View Full Code Here

        .buildSessionFactory();
  }

  @Bean
  public PlatformTransactionManager transactionManager() throws Exception {
    return new HibernateTransactionManager(sessionFactory());
  }
View Full Code Here

    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);
      }
    };

    final FilterChain filterChain2 = new FilterChain() {
      @Override
      public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
        throws IOException, ServletException {
        HibernateTransactionManager tm = new HibernateTransactionManager(sf2);
        TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
        tm.commit(ts);
        filter.doFilter(servletRequest, servletResponse, filterChain);
      }
    };

    FilterChain filterChain3 = new PassThroughFilterChain(filter2, filterChain2);
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.