[jboss-user] [JBoss Seam] - Seam with Hibernate Search

neilac333 do-not-reply at jboss.com
Thu Jan 17 14:49:56 EST 2008


I am using Hibernate Search in my Seam web application. All my unit tests and integration tests (using SeamTest), which are quite rigorous, are passing with flying colors.  I should note that the tests are of two categories:

1) My use of the Hibernate Search libraries outside of any container
2) My use of Seam components that coordinate getting parameters and results to and from mock versions of my HS code

Nowhere do I perform an integration test of Seam components with the real HS implementation.  Perhaps I should have since when I try to use the functionality in my actual application, I get the following: 


  | java.lang.ClassCastException: org.jboss.seam.persistence.FullTextHibernateSessionProxy
  |    at org.hibernate.search.impl.FullTextSessionImpl.<init>(FullTextSessionImpl.java:70)
  |    at org.hibernate.search.Search.createFullTextSession(Search.java:21)
  |    at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.getFullTextSession(FullTextEntityManagerImpl.java:37)
  |    at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.createFullTextQuery(FullTextEntityManagerImpl.java:60)
  |    at persistence.search.SearchImpl.getAdvancedSearchResults(SearchImpl.java:185)
  |    at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
  |    at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
  |    at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
  |    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
  |    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
  |    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
  |    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
  |    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
  |    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
  |    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
  |    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
  |    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
  |    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
  |    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
  |    at persistence.search.SearchImpl_$$_javassist_1.getAdvancedSearchResults()Ljava.util.List;(SearchImpl_$$_javassist_1.java:???)
  |    at web.SearchAction.doAdvancedSearch(SearchAction.java:186)
  |    at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
  |    at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
  |    at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
  |    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
  | 

What is interesting to me is that FullTextHibernateSessionProxy is a Seam class not part of the Hibernate Search library.  According to this

http://docs.jboss.com/seam/2.0.0.GA/api/org/jboss/seam/persistence/HibernateSessionProxy.html

...it looks like the class implements org.hibernate.Session.  However, look here:

http://anonsvn.jboss.org/repos/hibernate/search/trunk/src/java/org/hibernate/search/impl/FullTextSessionImpl.java

If I am correct, the instance of FullTextHibernateSessionProxy is being cast to org.hibernate.classic.Session, EventSource, and SessionImplementor while FullTextHibernateSessionProxy implements org.hibernate.Session,  SessionImplementor, and not EventSource at all.

Is my analysis correct?  If so, is this a bug in the way Seam and HS collaborate?  Most importantly, how can I work around this before I fall too far behind?

Thanks for any insight.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121081#4121081

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121081



More information about the jboss-user mailing list