I'm developing a seam application. It uses the Hibernate Search, and now It also need to use Criteria API.
I'm trying to create Criteria with following code :
and here it dies with following:
java.lang.ClassCastException: org.jboss.seam.persistence.FullTextEntityManagerProxy cannot be cast to org.hibernate.ejb.EntityManagerImpl
looking in deep I found that actually EntityManager injected from Seam isn't hibernateEntityManager - there is some Seam's class that implements EntityManager interface.
So the main question, how to configure SEAM HIBERNATE and HIBERNATE SEARCH to make them workable with HIBERNATE CRITERIA API ?
Ah... once more, now mine application is configured to run as the WAR (inside the maven and jetty-plugin)... but I gues that shouldn't be a problem.
EntityManager.getDelegate() is part of JPA, you do not need to cast to EntityManagerImpl. This would do:
Session session = (Session)entityManager.getDelegate();