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: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:setSessionFactory
 
@Repository("organizationDao") 
public class OrganizationDaoImpl extends HibernateDaoSupport implements OrganizationDao { 
 
  @Autowired 
  public OrganizationDaoImpl(SessionFactory sessionFactory) { 
    setSessionFactory(sessionFactory); 
  } 
 
  public Organization load(Long id) { 
    return (Organization) getHibernateTemplate().load(Organization.class, id); 
  } 
 
  public Organization persist(Organization organization) { 
    getHibernateTemplate().saveOrUpdate(organization); 
    return organization; 
  } 
 
  @SuppressWarnings("unchecked") 
  public Organization findByName(String orgName) { 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSessionFactory, isAllowCreate, getEntityInterceptor, getJdbcExceptionTranslator
 
	/** 
	 * 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 
	 */ 
	public final void setHibernateTemplate(HibernateTemplate hibernateTemplate) { 
		this.hibernateTemplate = hibernateTemplate; 
	} 
 
	/** 
	 * Return the HibernateTemplate for this DAO, 
	 * pre-initialized with the SessionFactory or set explicitly. 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setSessionFactory
 
@Repository("userDao") 
public class UserDaoImpl extends HibernateDaoSupport implements UserDao { 
 
  @Autowired 
  public UserDaoImpl(SessionFactory sessionFactory) { 
    setSessionFactory(sessionFactory); 
  } 
 
  public User load(Long id) { 
    return (User) getHibernateTemplate().load(User.class, id); 
  } 
 
  public User persist(User user) { 
    getHibernateTemplate().saveOrUpdate(user); 
    return user; 
  } 
 
  @SuppressWarnings("unchecked") 
  public User findUserByOrganizationAndUsername(Long organizationId, String username) { 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 *  
 */ 
@SuppressWarnings("unchecked") 
public class ContactDaoImpl extends HibernateDaoSupport implements ContactDao { 
 
	public ContactDaoImpl() { 
		// TODO Auto-generated constructor stub 
	} 
 
	public void addUpdateContact(Contact contact) { 
		getHibernateTemplate().merge(contact); 
	} 
 
	public void deleteContact(Contact contact) { 
		getHibernateTemplate().delete(contact); 
	} 
 
	public Collection<Contact> findAllContacts() { 
		return getHibernateTemplate().find("from Contact c"); 
		// return getHibernateTemplate().loadAll(Contact.class); 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setPackagesToScan, afterPropertiesSet, getObject, setDataSource, setHibernateProperties
public class AppConfigWithComponentScan 
{ 
    @Bean 
    public SessionFactory sessionFactory() throws ExceptionAnnotationSessionFactoryBean bean = new AnnotationSessionFactoryBean();
        bean.setDataSource(dataSource());
        bean.setPackagesToScan(new String[] {"org.springframework.issues"});
        bean.setHibernateProperties(hibernateProps());
        bean.afterPropertiesSet();
        return bean.getObject();
    } 
 
    private Properties hibernateProps()
    { 
        Properties jpaProperties = new Properties();
        jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
        jpaProperties.put("hibernate.hbm2ddl.auto", "create-drop");
        jpaProperties.put("hibernate.show_sql", false);
        jpaProperties.put("hibernate.format_sql", true);
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setDefaultFilterCondition, setFilterName, setParameterTypes, getDefaultCondition, getParameterTypes
     */ 
    public AbstractSecurityFilter() { 
        this(new Roles()); 
    } 
 
    public AbstractSecurityFilter(Roles roles) {
        this.roles = roles;
        this.setFilterName(getName());
        this.setParameterTypes(getParameterTypes());
        this.setDefaultFilterCondition(getDefaultCondition());
    } 
 
    public String getName() {
        return this.getClass().getSimpleName();
    } 
 
    public void disable(Session sess) {
	    sess.disableFilter(getName());
	    disableBaseFilters(sess);
    } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
package org.springframework.issues; 
 
import org.springframework.orm.hibernate3.support.HibernateDaoSupport; 
import org.springframework.stereotype.Repository; 
 
@Repository 
public class CustomerDAO extends HibernateDaoSupport 
{ 
    public void method () 
    { 
    } 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Spring Framework HibernateTransactionManager Methods: