Author: epbernard
Date: 2008-08-18 13:51:31 -0400 (Mon, 18 Aug 2008)
New Revision: 15097
Modified:
search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdPersonSub.java
search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdTest.java
Log:
hierarchical test
Modified:
search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdPersonSub.java
===================================================================
---
search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdPersonSub.java 2008-08-18
17:36:38 UTC (rev 15096)
+++
search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdPersonSub.java 2008-08-18
17:51:31 UTC (rev 15097)
@@ -1,9 +1,13 @@
package org.hibernate.search.test.id.providedId;
+import javax.persistence.Entity;
+
+import org.hibernate.search.annotations.Indexed;
+
/**
* @author Navin Surtani (<a
href="mailto:nsurtani@redhat.com">nsurtani@redhat.com</a>)
*/
-public class ProvidedIdPersonSub extends ProvidedIdPerson {
-
-
+@Indexed
+@Entity
+public class ProvidedIdPersonSub extends ProvidedIdPerson {
}
Modified:
search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdTest.java
===================================================================
---
search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdTest.java 2008-08-18
17:36:38 UTC (rev 15096)
+++
search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdTest.java 2008-08-18
17:51:31 UTC (rev 15097)
@@ -2,9 +2,9 @@
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Hits;
+import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
-import org.apache.lucene.search.IndexSearcher;
-import org.apache.lucene.search.Hits;
import org.hibernate.Session;
import org.hibernate.Transaction;
@@ -20,7 +20,8 @@
protected Class[] getMappings() {
return new Class[] {
- ProvidedIdPerson.class
+ ProvidedIdPerson.class,
+ ProvidedIdPersonSub.class
};
}
@@ -34,18 +35,18 @@
person2.setName( "Mini Goat" );
person2.setBlurb( "Eats cheese" );
- ProvidedIdPersonSub person3 = new ProvidedIdPersonSub();
- person3.setName ( "Regular goat" );
- person3.setBlurb ( "Is anorexic" );
+ ProvidedIdPersonSub person3 = new ProvidedIdPersonSub();
+ person3.setName( "Regular goat" );
+ person3.setBlurb( "Is anorexic" );
- Session session = openSession();
+ Session session = openSession();
FullTextSession fullTextSession = Search.getFullTextSession( session );
Transaction transaction = session.beginTransaction();
session.persist( person1 );
session.persist( person2 );
- session.persist( person3 );
+ session.persist( person3 );
- transaction.commit();
+ transaction.commit();
session.clear();
transaction = fullTextSession.beginTransaction();
@@ -57,8 +58,9 @@
//needs it. So we use plain Lucene
//we know there is only one DP
- DirectoryProvider provider = fullTextSession.getSearchFactory().getDirectoryProviders(
ProvidedIdPerson.class )[0];
- IndexSearcher searcher = new IndexSearcher( provider.getDirectory() );
+ DirectoryProvider provider = fullTextSession.getSearchFactory()
+ .getDirectoryProviders( ProvidedIdPerson.class )[0];
+ IndexSearcher searcher = new IndexSearcher( provider.getDirectory() );
Hits hits = searcher.search( luceneQuery );
searcher.close();
transaction.commit();
Show replies by date