1 Reply Latest reply on Jul 27, 2008 7:16 PM by Pete Muir

    Seam enabled hibernate filter problem

    Romain More Newbie

      I tried to setup a hibernate filter, enabled in components.xml, with a parameter.
      I have tested 3 scenarii :



      1. in hibernate filter, the parameter has type long, in the EL value in components.xml I inject a value of type Long : EL value result is always empty

      2. in hibernate filter def, long parameter, and String as EL result value : exception wrong type for parameter

      3. string as hibernte filter parameter and String as EL result value : OK !




      So I have 2 questions :



      • Is it a Seam or Hibernate problem ?

      • Is it a EL bug ?



      My components.xml code :


      <persistence:filter name="hasRights" enabled="#{identity.loggedIn}">
        <persistence:name>hasRights</persistence:name>
        <persistence:parameters>
          <key>companyId</key>
          <value>#{companyId}</value>
        </persistence:parameters>
      </persistence:filter>
      <persistence:managed-persistence-context name="restrictedEntityManager"
        auto-create="true"
        persistence-unit-jndi-name="java:/appEntityManagerFactory">
        <persistence:filters>
          <value>#{hasRights}</value>
        </persistence:filters>
      </persistence:managed-persistence-context>



      The definition of the filter :


      @FilterDefs(value={
        @FilterDef(name="hasRights", parameters={@ParamDef(type="string", name="companyId")})
      })
      



      The Filter :


      @Filters(value={
          @Filter(
            name="hasRights", 
            condition="(company_id = :companyId)"
          )
        })