-
1. Re: Hibernate Filter really work with seam ???
swd847 Mar 19, 2010 4:18 AM (in response to bussard)It works fine.
If you need help you need to post details of what you have tried and the error you are getting.
-
2. Re: Hibernate Filter really work with seam ???
bussard Mar 19, 2010 1:39 PM (in response to bussard)Hi Stuart,
I was following this tutorial
http://www.next-presso.fr/2008/10/how-to-use-hibernate-filters-in-seam/lang/en
I simplify the example trying to find the error and in my components.xml I edited like this:
<!-- Create the Filter without parameters for while --> <persistence:filter name="filterClasse" enabled="#{true}"> <persistence:name>filtroClasse</persistence:name> </persistence:filter> <!-- Configure the filter to use with the Default Entity Maneger --> <persistence:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/metasEntityManagerFactory"> <persistence:filters> <value>#{filterClasse}</value> </persistence:filters> </persistence:managed-persistence-context> <!-- Only for test with enableFilter() function --> <factory name="session" scope="STATELESS" auto-create="true" value="#{entityManager.delegate}"/>
and at my class:
@org.hibernate.annotations.FilterDef(name = "filtroClasse") @Entity @Table(name = "META2", schema = "ESTATISTICA") @org.hibernate.annotations.Filter(name = "filtroClasse", condition="MES = 'XX'" )
As you can read above I'm trying a static condition first, but I want to use parameters too.
Where are my mistakes ?
-
3. Re: Hibernate Filter really work with seam ???
cbensemann Mar 21, 2010 3:30 AM (in response to bussard)So do you get any errors with the above configuration? Please post these if you did. I know I was a bit confused when I created my first filter in Seam. The docs don't really cover this well. I also basically followed the tutorial you did and afterwards I typed up a summary of what I did on my seam tips pages https://sites.google.com/a/softwarefactory.co.nz/seam-tips/other/hibernate-filters. It basically repeats what was stated in the tutorial you have already found but maybe reading it stated in a slightly different way with different examples may help.
If you get it set up correctly and have enabled hibernate printing of sql you should see your condition printed out as a where clause in queries using the filter.
-
4. Re: Hibernate Filter really work with seam ???
bussard Mar 24, 2010 3:12 PM (in response to bussard)Thanks Craig,
I follow your steps and its works. I realy don't know what was my mistake, but now it works !