I'm trying index with Hibernate Search;
Code:
EntityManager em = this.getEntityManager();
FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.createFullTextEntityManager(em);
log.debug("Starting initial indexing.");
for (int i = 0; i < part.size(); i++) {
String query = "select las.description from org.sakaiproject.tidia.scshared.model.Learning as las";
log.warn("\n"+ query);
javax.persistence.Query queryResult = em.createQuery(query);//createQuery(query);
Iterator it = queryResult.getResultList().iterator();
try{
while(it.hasNext()){
Object obj = it.next();
if(obj instanceof Learning){
fullTextEntityManager.index(obj);
,,,
}
}
The problem is when I try the code above nothing happen in index, because the result is a set of string type.
If I try to do this:
Code:
String query = "from org.sakaiproject.tidia.scshared.model.Learning as las";
log.warn("\n"+ query);
Then the result is an object type Learning and then I can index.
Somebody can help me mount this string?
Thanks.