Results 1 to 5 of 5

Thread: Parameter for Hibernate Filter?

  1. #1
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    24

    Default Parameter for Hibernate Filter?

    Are there any plans of supporting not only the enabling of Filters, but also the parameterizing of it in HibernateTemplate ?

    Background:
    Hibernate 3 provides this new feature: Filter
    see http://www.hibernate.org/hib_docs/v3...l/filters.html
    And I saw a fix in the JIRA ( http://opensource.atlassian.com/proj...browse/SPR-888 ) to enable Filters via
    Code:
    HibernateAccessor.setFilterName(String filter)
    So far, so good. The Problem comes in with Parameters for this Filter.
    Within my custom HibernateCallback I can do something like:
    Code:
    session.enableFilter("userFilter").setParameter("userId", userId);
    But with HibernateTemplate this is missing.
    I would like to call something like:

    Code:
    getHibernateTemplate().setFilterName("userFilter").setParameter("userId", filter.getUserID());
    Am I missing something? or are there already any plans for supporting this? Should I place this into Springs JIRA?

  2. #2

    Default

    Is there any progress with the issue about enabling filter parameters passing thru HibernateTemplate?
    Looks like filters from Hibernate3 is gettging known widly =)

  3. #3

    Default

    What is the benifit of getHibernateTemplate.enableFilter(name) if we still need to do the 'seesion.setFilterName(name).setParameter()' to setup values for filter's paramers ?

    It looks like it is only useful for parameterless filters, but i bet the large amount of filters will actually do have paramers, since this is the filter used for.

    So, is there any plans to add support for paramers initiazliation in HibernateTemplate ?

  4. #4
    Join Date
    Aug 2004
    Location
    Germany
    Posts
    24

    Default

    Since this topics gets some more attention I raised a feature request here:
    http://opensource2.atlassian.com/pro...rowse/SPR-1344

    I know it is wrongly classified as a bug, but it really is a feature request.

  5. #5
    Join Date
    Aug 2004
    Location
    San Francisco, CA
    Posts
    66

    Default

    Look at the signature/documentation for enableFilter(...):

    Code:
    /**
     * Return an enabled Hibernate Filter for the given filter name.
     * The returned Filter instance can be used to set filter parameters.
     * @param filterName the name of the filter
     * @return the enabled Hibernate Filter (either already enabled
     * or enabled on the fly by this operation)
     * @throws IllegalStateException if we are not running within a
     * transactional Session (in which case this operation does not make sense)
     */
    Filter enableFilter(String filterName) throws IllegalStateException;
    "The returned Filter instance can be used to set filter parameters."

    It returns the enabled Filter object, and then you can set any parameters required for the filter to actually be applied.

    Christian

Similar Threads

  1. after login redirects incorrectly
    By ryan.tyer in forum Security
    Replies: 1
    Last Post: Oct 10th, 2005, 05:16 PM
  2. Replies: 7
    Last Post: Sep 13th, 2005, 01:45 AM
  3. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  4. Replies: 5
    Last Post: Mar 18th, 2005, 04:01 AM
  5. Transaction Management
    By caverns in forum Data
    Replies: 3
    Last Post: Mar 8th, 2005, 06:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •