I have to generate a query for two non related entities
query is 'select e0.a as a e1.b as b from entity0 as e0,entity1 as e1 where e0.id = e1.id '
I am using hibernate-search-3.1.0.GA:
I am not sure how to wrap the lucene query...
I tried
MultiFieldQueryParser mparser = new MultiFieldQueryParser(new String[] { "aTerm", "bTerm" },new StandardAnalyzer());
//aTerm,bTerm mapped to corresponding attributes in different classes
Query query = mparser.parse(query);
FullTextQuery fq = fs.createFullTextQuery(query, org.hibsearch.data.entity.Entity0.class,org.hibsearch.data.entity.Entity1.class);
When its exectued i get the results for each entities, as it generates two seperate SQLs than a single one (hib search works this way).
Any idea/hack to simulate the above query (joined version) in hibernate search ?
|