[jboss-user] [JBoss Seam] - Re: @Filter example
anescu
do-not-reply at jboss.com
Wed May 16 05:00:57 EDT 2007
Ok, I have some progress:
1) I defined 2 entity managers in components.xml:
<core:managed-persistence-context name="entityManager"
| auto-create="true"
| persistence-unit-jndi-name="java:/entityManagerFactory"/>
|
| <core:filter name="hubFilteredChannels">
| <core:name>hubFilteredChannels</core:name>
| <core:parameters>
| <key>currentHub</key>
| <value>#{currentHub}</value>
| </core:parameters>
| </core:filter>
|
| <core:managed-persistence-context name="filteredEntityManager"
| auto-create="true"
| entity-manager-factory="#{entityManager}">
| <core:filters><value>#{hubFilteredChannels}</value></core:filters>
| </core:managed-persistence-context>
2) Then I override the getPersistenceContextName in my entity List class:
@Override
| protected String getPersistenceContextName()
| {
| System.out.println( "### debug step" );
| return "filteredEntityManager";
| }
3) Now i can deploy and browse the other parts of the application as before using the filter, but i get an exception when opening the entity list screen, something about a ClassCastException:
Caused by: java.lang.ClassCastException: org.jboss.seam.persistence.EntityManagerProxy
| at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:169)
| at org.jboss.seam.core.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:77)
| at org.jboss.seam.core.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:105)
| at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046044#4046044
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046044
More information about the jboss-user
mailing list