]
Sanne Grinovero closed HSEARCH-479.
-----------------------------------
Resolution: Fixed
Fix Version/s: 3.2.0.Beta2
Return empty result list - Composed primary key - lucene search ok -
primary key bridge ok
------------------------------------------------------------------------------------------
Key: HSEARCH-479
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-479
Project: Hibernate Search
Issue Type: Bug
Components: mapping
Affects Versions: 3.1.0.GA
Environment: Eclipse SDK - Version: 3.3.2
MySql - 5.1.44-community
PostgreSQL - 1.8.3
Hibernate Search - 3.1.0.GA
hibernate-entitymanager - 3.4.0.GA
hibernate-annotations - 3.4.0.GA
hibernate-core - 3.3.2.GA
Reporter: Gaël Saunier
Fix For: 3.2.0.Beta2
Attachments: HS-test-Primary-Key-Compose.zip
Entity :
@Indexed
@Entity
public class Demande extends DemandeEntity {
...
Superclass :
...
@MappedSuperclass
public class DemandeEntity implements Serializable {
...
@FieldBridge(impl=Demande_DocumentId_Bridge.class)
@DocumentId
@IndexedEmbedded
private DemandePK demandePK;
...
Bridge :
...
public class Demande_DocumentId_Bridge implements TwoWayStringBridge {
...
public Object stringToObject(String arg0) {
String[] tab = arg0.split("þ");
return new DemandePK(tab[0],tab[1],tab[2]);
}
...
public String objectToString(Object arg0) {
DemandePK d = (DemandePK)arg0;
return d.getUiPhar()+"þ"+d.getRdes()+"þ"+d.getTypeDem();
}
}
TestClass :
...
public static void main(String[] args) {
ClassPathXmlApplicationContext appContext = new
ClassPathXmlApplicationContext("META-INF/PostGreSQL-applicationContext.xml");
GenericSearchManagerMetier demandeSearchManagerMetier =
(GenericSearchManagerMetier) appContext.getBean("demandeSearchManagerMetier");
String rqt = "+text:jean +text:francois";
BeanLuceneQuery beanLuceneQuery = new BeanLuceneQuery(rqt);
BeanResultats br = null;
try {
br = demandeSearchManagerMetier.searchLuceneQuery(beanLuceneQuery,0,15);
} catch (NegativeOrNullInteger e) {
e.printStackTrace();
}
System.out.print("Nb total : "+br.getNbTotalResults()+"\n");
System.out.print("Nb Résultats :
"+br.getResults().size()+"\n");
}
Lucene part of process is alright !
Primary keys DemandePK generated by HS just before requesting DB are alright
but no return...
br.getNbTotalResults() return 16
but
br.getResults().size() return 0
Beans are correctly implemented.
I traced return of :
List<T> resultList = q.getResultList();
but list size = 0
stdout :
...
Hibernate: select this_ (..xxx..) from Demande this_ where ((this_.RDES, this_.TYPE_DEM,
this_.UI_PHAR) in ((?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?,
?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?, ?), (?, ?,
?)))
Nb total : 16
Nb Résultats : 0
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: