Quote:
How does the code between opening and closing the session look like which causes the error?
Thank you for your reply hardy.
Here is the code between opening and closing of session which i had written for testing the problem.
FullTextSession fullTextSession = Search.getFullTextSession(session);
Class[] classes={AssayTest.class,ProjectTest.class};
String[] fields=null;
try {
fields=Indexing.reindexEntities(classes,fullTextSession); //reindex entities and return names of fields in array
} catch (Exception e) {
e.printStackTrace();
}
// No problem upto this
Transaction tx = fullTextSession.beginTransaction();
MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, new StandardAnalyzer());
org.apache.lucene.search.Query query=null;
try {
query = parser.parse("ProjectNestle");
// wrap Lucene query in a org.hibernate.Query
org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery(query, classes);
// execute search
List result = hibQuery.list();
System.out.println("Hibernate result size:"+result.size());
for (Object object:result){
Class c=object.getClass();
System.out.println("Name:"+c.getName());
if (object instanceof ProjectTest){
ProjectTest project=(ProjectTest)object;
System.out.println("Project name:"+project.getProjectName());
//Problematic code begins
Set<AssayTest> list=project.getAssayTests();
for (AssayTest assay:list){
System.out.println("assay name from project" +assay.getAssayName());
}
//Problematic code ends
}
}
}
catch (Exception e) {
System.out.println("Message:"+e.getMessage());
e.printStackTrace();
}
tx.commit();
session.close();