Spring Framework HibernateTransactionManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework HibernateTransactionManager class.

This code example shows how to use the following methods:
	@Override 
	protected void setUpResources(DataSource dataSource) throws Exception { 
		sessionFactory = getSessionFactory(dataSource); 
		hibernateTemplate = new HibernateTemplate(sessionFactory); 
		hibernateTemplate.setCheckWriteOperations(false); 
		HibernateTransactionManager tm = new HibernateTransactionManager(sessionFactory); 
		executionListener = new HibernateFlowExecutionListener(sessionFactory, tm); 
		rowCount = 1; 
	} 
 
	@Override 
	protected FlowExecutionListener getListener() { 
		return executionListener; 
	} 
 
	@Override 
	protected void assertSessionNotBound() { 
		assertNull(TransactionSynchronizationManager.getResource(sessionFactory)); 
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:afterPropertiesSet, getObject, setDataSource, setMappingLocations
	private DataSource dataSource;
 
	private void initializeItemReader(HibernateCursorItemReader<?> reader,
			String hsqlQuery) throws Exception {
 
		LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
		factoryBean.setDataSource(dataSource);
		factoryBean.setMappingLocations(new Resource[] { new ClassPathResource(
				"Foo.hbm.xml", getClass()) });
		factoryBean.afterPropertiesSet();
 
		SessionFactory sessionFactory = factoryBean
				.getObject();
 
		reader.setQueryString(hsqlQuery);
		reader.setSessionFactory(sessionFactory);
		reader.afterPropertiesSet();
		reader.setSaveState(true);
		reader.open(new ExecutionContext());
 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:doGetTransaction, getSessionFactory
 
	@Override 
	protected Object doGetTransaction() {
		SessionHolder sessionHolder =
			(SessionHolder)TransactionSynchronizationManager.getResource(
				getSessionFactory());
 
		if (sessionHolder != null) {
			LastSessionRecorderUtil.setLastSession(sessionHolder.getSession());
		} 
 
		return super.doGetTransaction(); 
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:afterPropertiesSet, getObject, setDataSource, setHibernateProperties, setPackagesToScan
  } 
 
  @Bean 
  public SessionFactory sessionFactoryBean() { 
    try { 
      LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean(); 
      lsfb.setDataSource(dataSource()); 
      lsfb.setPackagesToScan("spittr.domain"); 
      Properties props = new Properties(); 
      props.setProperty("dialect", "org.hibernate.dialect.H2Dialect"); 
      lsfb.setHibernateProperties(props); 
      lsfb.afterPropertiesSet(); 
      SessionFactory object = lsfb.getObject(); 
      return object; 
    } catch (IOException e) { 
      return null; 
    } 
  } 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setDataSource, setHibernateProperties, setPackagesToScan
    @Autowired 
    private PropertiesStrategyManager hibPropStrategyManager; 
 
    @Bean 
    public LocalSessionFactoryBean gpSessionFactoryBean() { 
        final LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean(); 
        factoryBean.setDataSource(this.persitenceDataSource); 
        factoryBean.setPackagesToScan( 
                this.gpPersistenceConnector.getPackagesToScan()); 
        factoryBean.setHibernateProperties( 
                this.hibPropStrategyManager.getProperties()); 
 
        return factoryBean; 
    } 
 
    @Bean 
    public HibernateTransactionManager transactionManager() { 
        final HibernateTransactionManager txManager = new HibernateTransactionManager(); 
        txManager.setSessionFactory(this.gpSessionFactoryBean().getObject()); 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
			request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST); 
		} 
		else { 
			logger.debug("Opening Hibernate Session in OpenSessionInViewInterceptor"); 
			Session session = openSession(); 
			SessionHolder sessionHolder = new SessionHolder(session); 
			TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder); 
 
			AsyncRequestInterceptor asyncRequestInterceptor = 
					new AsyncRequestInterceptor(getSessionFactory(), sessionHolder); 
			asyncManager.registerCallableInterceptor(participateAttributeName, asyncRequestInterceptor); 
			asyncManager.registerDeferredResultInterceptor(participateAttributeName, asyncRequestInterceptor); 
		} 
	} 
 
	@Override 
	public void postHandle(WebRequest request, ModelMap model) { 
	} 
 
	/** 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSession
	} 
 
	private void closeAfterTimeout() { 
		if (this.timeoutInProgress) {
			logger.debug("Closing Hibernate Session after async request timeout");
			SessionFactoryUtils.closeSession(sessionHolder.getSession());
		} 
	} 
 
 
	// Implementation of DeferredResultProcessingInterceptor methods 
 
	public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {
	} 
 
	public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {
	} 
 
	public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {
	} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	 * @param sessionFactory the Hibernate SessionFactory to create a HibernateTemplate for 
	 * @return the new HibernateTemplate instance 
	 * @see #setSessionFactory 
	 */ 
	protected HibernateTemplate createHibernateTemplate(SessionFactory sessionFactory) {
		return new HibernateTemplate(sessionFactory);
	} 
 
	/** 
	 * Return the Hibernate SessionFactory used by this DAO. 
	 */ 
	public final SessionFactory getSessionFactory() {
		return (this.hibernateTemplate != null ? this.hibernateTemplate.getSessionFactory() : null);
	} 
 
	/** 
	 * Set the HibernateTemplate for this DAO explicitly, 
	 * as an alternative to specifying a SessionFactory. 
	 * @see #setSessionFactory 
	 */ 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:afterPropertiesSet, getObject, setDataSource, setHibernateProperties, setPackagesToScan
    } 
 
    @Bean 
    public SessionFactory sessionFactory() throws IOException { 
 
        LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean(); 
        factoryBean.setPackagesToScan(getMappedPackageNames()); 
        factoryBean.setDataSource(dataSource()); 
        factoryBean.setHibernateProperties(hibernateProperties()); 
 
        factoryBean.afterPropertiesSet(); 
 
        return factoryBean.getObject(); 
    } 
 
    @Bean 
    public PlatformTransactionManager transactionManager() throws IOException { 
        return new HibernateTransactionManager(sessionFactory()); 
    } 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:afterPropertiesSet, getObject, setDataSource, setEntityInterceptor, setHibernateProperties
     */ 
    @Bean 
    public SessionFactory sessionFactory() throws IOException {
        log.info("SessionFactory Bean을 생성합니다..."); 
 
        LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean();
 
        String[] packagenames = getMappedPackageNames();
        if (packagenames != null && packagenames.length > 0) {
            log.debug("hibernate용 entity를 scan합니다. packages=[{}]", arrayToCommaDelimitedString(packagenames));
            factoryBean.setPackagesToScan(packagenames);
        } 
 
        // Naming strategy 
        NamingStrategy ns = getNamingStrategy();
        if (ns != null)
            factoryBean.setNamingStrategy(ns);
 
        // Hibernate properties 
        factoryBean.setHibernateProperties(hibernateProperties());

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Spring Framework HibernateTransactionManager Methods: