Hibernate version:
Core 3.2.5 (annot 3.3.0, entitymgr 3.3.1, search 3.0.0B4)
Mapping documents: using annotations
Quote:
@Entity
@Table(name = "RB_QM_TEMPLATE")
@javax.persistence.SequenceGenerator(
name="RB_QM_TEMPLATE_SEQ",
sequenceName="RB_QM_TEMPLATE_SEQ")
@Indexed(index="lucene/templates")
public class Template {
...
@Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="RB_QM_TEMPLATE_SEQ")
@Column(name = "qm_template_id")
@DocumentId
private int templateId = 0;
@Column(name = "qm_template_name")
@Field(index= Index.UN_TOKENIZED)
private String templateName = "";
...
and the persistence.xml
Quote:
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.search.default.directory_provider" value="org.hibernate.search.store.FSDirectoryProvider"/>
<property name="hibernate.search.worker.backend" value="lucene"/>
<property name="hibernate.search.worker.execution" value="sync"/>
<property name="hibernate.search.reader.strategy" value="shared"/>
</properties>
Code between sessionFactory.openSession() and session.close():Quote:
ApplicationContext factory = new FileSystemXmlApplicationContext("quoteEngineContext.xml");
EntityManager sess = ((EntityManagerFactory) factory.getBean("entityManagerFactory")).createEntityManager();
FullTextEntityManager fullTextEntityManager = Search.createFullTextEntityManager(sess);
EntityTransaction txn = fullTextEntityManager.getTransaction();
txn.begin();
int idxCount = 0;
List<Inst> ilist = sess.createQuery("select i from Inst i where i.libelle like '%asian%'").getResultList();
for (Inst i: ilist){
fullTextEntityManager.index(i);
idxCount++;
}
log.info("Indexed "+idxCount+" insts");
txn.commit();
Then in same method, I do this:
Quote:
QueryParser parser = new QueryParser("", new StopAnalyzer() );
org.apache.lucene.search.Query luceneQuery = parser.parse( "8%" );
javax.persistence.Query fullTextQuery = fullTextEntityManager.createFullTextQuery( luceneQuery, Inst.class );
List result = fullTextQuery.getResultList(); //return a list of managed objects
The problem is that this result list is always empty. I can see the lucene index files have been created.
Full stack trace of any exception that occurs:
None
Name and version of the database you are using:
Oracle 10g
Thanks in advance for any tips.
Chris