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
19. Mar 2010, 02:32 America/New_York | Link

Hello all,

Is it a bug with seam ? (My version is 2.2.1.CR1)

I tried this:

http://www.next-presso.fr/2008/10/how-to-use-hibernate-filters-in-seam/lang/en

and this

http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/seam/Seam_Reference_Guide/Seam_and_ObjectRelational_Mapping-Using_the_JPA_delegate.html

and this

http://relation.to/2002.lace

Filter is a great feature of Hibernate and could turn my life a lot of easy.

Any one has implemented hibernate filters with seam ???

4 Replies:
19. Mar 2010, 04:18 America/New_York | Link

It works fine.

If you need help you need to post details of what you have tried and the error you are getting.

19. Mar 2010, 13:39 America/New_York | Link

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 ?

21. Mar 2010, 03:30 America/New_York | Link

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.

Rating:  * * * *
24. Mar 2010, 15:12 America/New_York | Link

Thanks Craig,

I follow your steps and its works. I realy don't know what was my mistake, but now it works !