-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Trouble creating dinamic query to index entity with jpa
PostPosted: Thu Jan 22, 2009 3:20 pm 
Newbie

Joined: Tue Jul 29, 2008 2:01 pm
Posts: 5
Location: Brasil
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.

_________________
--------------------
Iuliana Souza


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.