I'm trying to do something I thought was simple: manually indexing an entity in Seam. But I keep getting the following error:
object is not an instance of declaring class
I've searched around and found out something about an "unproxy" method but I'm not sure that applies. The code looks like this:
Code:
FullTextEntityManager ftem = (FullTextEntityManager)entityManager;
MyClassToIndex myClass = ftem.find(MyClassToIndex.class, id);
ftem.index(myClass);
The exception occurs in sometime during the index method. Here is the relevant part of the stack trace:
Code:
SEVERE: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.persistence.HibernateSessionInvocationHandler.invoke(HibernateSessionInvocationHandler.java:82)
at $Proxy147.getActionQueue(Unknown Source)
at org.hibernate.search.backend.impl.EventSourceTransactionContext.registerSynchronization(EventSourceTransactionContext.java:96)
at org.hibernate.search.backend.impl.TransactionalWorker.performWork(TransactionalWorker.java:70)
at org.hibernate.search.impl.FullTextSessionImpl.index(FullTextSessionImpl.java:186)
at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.index(FullTextEntityManagerImpl.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:46)
at $Proxy82.index(Unknown Source)
Any ideas? Seems like there is a simple fix to this. I'm using Seam 2.2.1, Hibernate 3.5.4 and Hibernate Search 3.2.2-SNAPSHOT.
-JF