Java Code Examples for org.hibernate.Session#enableFilter()

The following examples show how to use org.hibernate.Session#enableFilter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HibernateAccessor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Enable the specified filters on the given Session.
 * @param session the current Hibernate Session
 * @see #setFilterNames
 * @see org.hibernate.Session#enableFilter(String)
 */
protected void enableFilters(Session session) {
	String[] filterNames = getFilterNames();
	if (filterNames != null) {
		for (String filterName : filterNames) {
			session.enableFilter(filterName);
		}
	}
}
 
Example 2
Source File: HibernateTemplate.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
	Session session = getSessionFactory().getCurrentSession();
	Filter filter = session.getEnabledFilter(filterName);
	if (filter == null) {
		filter = session.enableFilter(filterName);
	}
	return filter;
}
 
Example 3
Source File: HibernateTemplate.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Enable the specified filters on the given Session.
 * @param session the current Hibernate Session
 * @see #setFilterNames
 * @see org.hibernate.Session#enableFilter(String)
 */
protected void enableFilters(Session session) {
	String[] filterNames = getFilterNames();
	if (filterNames != null) {
		for (String filterName : filterNames) {
			session.enableFilter(filterName);
		}
	}
}
 
Example 4
Source File: HibernateTemplate.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
	Session session = getSessionFactory().getCurrentSession();
	Filter filter = session.getEnabledFilter(filterName);
	if (filter == null) {
		filter = session.enableFilter(filterName);
	}
	return filter;
}
 
Example 5
Source File: HibernateTemplate.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Enable the specified filters on the given Session.
 * @param session the current Hibernate Session
 * @see #setFilterNames
 * @see Session#enableFilter(String)
 */
protected void enableFilters(Session session) {
	String[] filterNames = getFilterNames();
	if (filterNames != null) {
		for (String filterName : filterNames) {
			session.enableFilter(filterName);
		}
	}
}
 
Example 6
Source File: HibernateTemplate.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
	Session session = SessionFactoryUtils.getSession(getSessionFactory(), false);
	Filter filter = session.getEnabledFilter(filterName);
	if (filter == null) {
		filter = session.enableFilter(filterName);
	}
	return filter;
}
 
Example 7
Source File: HibernateAccessor.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Enable the specified filters on the given Session.
 * @param session the current Hibernate Session
 * @see #setFilterNames
 * @see org.hibernate.Session#enableFilter(String)
 */
protected void enableFilters(Session session) {
	String[] filterNames = getFilterNames();
	if (filterNames != null) {
		for (String filterName : filterNames) {
			session.enableFilter(filterName);
		}
	}
}
 
Example 8
Source File: HibernateTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
	Session session = SessionFactoryUtils.getSession(getSessionFactory(), false);
	Filter filter = session.getEnabledFilter(filterName);
	if (filter == null) {
		filter = session.enableFilter(filterName);
	}
	return filter;
}
 
Example 9
Source File: HibernateTemplate.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Enable the specified filters on the given Session.
 * @param session the current Hibernate Session
 * @see #setFilterNames
 * @see Session#enableFilter(String)
 */
protected void enableFilters(Session session) {
	String[] filterNames = getFilterNames();
	if (filterNames != null) {
		for (String filterName : filterNames) {
			session.enableFilter(filterName);
		}
	}
}
 
Example 10
Source File: HibernateTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
	Session session = getSessionFactory().getCurrentSession();
	Filter filter = session.getEnabledFilter(filterName);
	if (filter == null) {
		filter = session.enableFilter(filterName);
	}
	return filter;
}
 
Example 11
Source File: HibernateTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Enable the specified filters on the given Session.
 * @param session the current Hibernate Session
 * @see #setFilterNames
 * @see Session#enableFilter(String)
 */
protected void enableFilters(Session session) {
	String[] filterNames = getFilterNames();
	if (filterNames != null) {
		for (String filterName : filterNames) {
			session.enableFilter(filterName);
		}
	}
}
 
Example 12
Source File: HibernateTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
	Session session = getSessionFactory().getCurrentSession();
	Filter filter = session.getEnabledFilter(filterName);
	if (filter == null) {
		filter = session.enableFilter(filterName);
	}
	return filter;
}
 
Example 13
Source File: HibernateTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Enable the specified filters on the given Session.
 * @param session the current Hibernate Session
 * @see #setFilterNames
 * @see org.hibernate.Session#enableFilter(String)
 */
protected void enableFilters(Session session) {
	String[] filterNames = getFilterNames();
	if (filterNames != null) {
		for (String filterName : filterNames) {
			session.enableFilter(filterName);
		}
	}
}
 
Example 14
Source File: HibernateTemplate.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
	Session session = obtainSessionFactory().getCurrentSession();
	Filter filter = session.getEnabledFilter(filterName);
	if (filter == null) {
		filter = session.enableFilter(filterName);
	}
	return filter;
}
 
Example 15
Source File: HibernateTemplate.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Enable the specified filters on the given Session.
 * @param session the current Hibernate Session
 * @see #setFilterNames
 * @see Session#enableFilter(String)
 */
protected void enableFilters(Session session) {
	String[] filterNames = getFilterNames();
	if (filterNames != null) {
		for (String filterName : filterNames) {
			session.enableFilter(filterName);
		}
	}
}
 
Example 16
Source File: HibernateTemplate.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
public Filter enableFilter(String filterName) throws IllegalStateException {
	Session session = obtainSessionFactory().getCurrentSession();
	Filter filter = session.getEnabledFilter(filterName);
	if (filter == null) {
		filter = session.enableFilter(filterName);
	}
	return filter;
}
 
Example 17
Source File: AbstractHibernateDAO.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
protected void enableTenantFilter(Session session, String tenantId) {
	Filter filter = session.enableFilter(TENANT_FILTER_NAME);
	filter.setParameter("tenant", tenantId);
}