-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate filter problem (Seam app)
PostPosted: Tue Apr 08, 2008 3:32 am 
Newbie

Joined: Tue Apr 08, 2008 3:27 am
Posts: 1
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


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 08, 2008 3:32 pm 
Newbie

Joined: Tue Apr 08, 2008 3:31 pm
Posts: 1
Location: RU, Saint-Petersburg
try http://forum.hibernate.org/viewtopic.ph ... d0535c7506


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.