hi all -
I am trying to use FullTextEntityManager (and Spring) but getting a 'Session is closed' exception. I am able to query fine the first time, but the 2nd time, the exception is thrown. Here's my config:
Code:
@Service
@Transactional(readOnly = true, propagation=Propagation.SUPPORTS)
public class SearchServiceImpl extends BaseService implements SearchService {
public List<StrainSearchResultsListItem> advancedSearch(Pageable page,String species) {
return searchRepository.advancedSearch(page, species);
}
Code:
@Repository
@Transactional(readOnly = true)
public class SearchRepositoryImpl implements SearchRepository {
@PersistenceContext
public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
protected FullTextEntityManager getFullTextEntityManager() {
if (fullTextEntityManager == null) {
fullTextEntityManager = Search.getFullTextEntityManager(getEntityManager());
}
return fullTextEntityManager;
}
As soon as I call:fullTextQuery.getResultList()
Code:
FullTextQuery fullTextQuery =
getFullTextEntityManager()
.createFullTextQuery(booleanQuery, Strain.class);
fullTextQuery.getResultList()
the second time the exception is thrown. Any help is appreciated.
thanks