Greetings
I have a very simple hibernate filter on a my CUSTOMER table. Essentially it filters all inactive customers based on a status flag (Y/N).
Filter def:
@org.hibernate.annotations.FilterDef(
name = "activeAccountFilter",
parameters = {@org.hibernate.annotations.ParamDef(name = "activeAccountFlag", type="string")}
)
@org.hibernate.annotations.Filter(
name = "activeAccountFilter",
condition = "STSFLG = 'Y'"
)
components.xml
-------------------
<core:filter name="activeAccountFilter">
<core:name>activeAccountFilter</core:name>
</core:filter>
Now there are couple of of Named queries in the same class ...
@NamedQueries({
@NamedQuery(
name="Customer.getByAccountNumber",
query= "select c " +
"from Customer c " +
"where c.customerID = :customerID"),
@NamedQuery(
name="Customer.getById",
query= "select c " +
"from Customer c " +
"where c.id = :id")
})
Now my Seam tests for looking up the customer works(i.e: only active customer is retrieved) only for the latter one c.id=id). Note: id is the primary key.
The only difference between the queries is the criteria first one is not a primary key.
Here is o/p from SeamTest.... note: the filter is not bound to the query Customer.getByAccountNumber
[testng] Mar 29, 2008 1:23:38 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
[testng] INFO: Binding Named query: Customer.getByAccountNumber => select c from Customer c where c.customerID = :customerID
[testng] Mar 29, 2008 1:23:38 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
[testng] INFO: Binding Named query: Customer.getById => select c from Customer c where c.id = :id
[testng] Mar 29, 2008 1:23:38 PM *org.hibernate.cfg.AnnotationBinder bindFilterDef*
[testng] INFO: Binding filter definition: activeAccountFilter
Is this a limitation or I'm missing something here?
Seam version : 1.2.1GA All Seam components are POJO's, no EJB.
Database : Embedded hsqlDB
|