Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
25. Jul 2008, 15:59 CET | Link

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)"
    )
  }) 

1 Reply:
27. Jul 2008, 19:16 CET | Link

Yeah, this might be a problem with Seam. File a feature request in JIRA.