You have not added anything to the database (in your code). If you did outside of your code, you need to index the database before you can trace it. To do this, do the following:
FullTextSession fullTextSession = Search.getFullTextSession(session); fullTextSession.createIndexer().startAndWait();
And you do not need an open transaction to search for material, so you can delete this line org.hibernate.Transaction tx = fullTextSession.beginTransaction();
(and replace it with startAndWait()
above)
Link: http://hibernate.org/search/documentation/getting-started/#indexing (since Lucene does not know about your DBMS and vice versa, Hibernate Search is the relationship between them and indexing your data is what makes it searchable Lucene)
source share