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

The following are Jave code examples for showing how to use enableFilter() of the org.hibernate.Session class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: lams   File: HibernateTemplate.java   View Source Code Vote up 5 votes
/**
 * 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
Project: lams   File: HibernateTemplate.java   View Source Code Vote up 5 votes
@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
Project: lams   File: HibernateAccessor.java   View Source Code Vote up 5 votes
/**
 * 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
Project: lams   File: HibernateTemplate.java   View Source Code Vote up 5 votes
@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;
}