[jboss-cvs] jboss-seam/examples/blog/src/actions ...
Emmanuel Bernard
emmanuel.bernard at jboss.com
Thu Sep 6 14:05:30 EDT 2007
User: ebernard
Date: 07/09/06 14:05:30
Modified: examples/blog/src/actions IndexerService.java
SearchService.java
Log:
JBSEAM-1783 add JPA support for HSearch and update the examples
Revision Changes Path
1.3 +4 -4 jboss-seam/examples/blog/src/actions/IndexerService.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: IndexerService.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/blog/src/actions/IndexerService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- IndexerService.java 16 Jul 2007 15:11:38 -0000 1.2
+++ IndexerService.java 6 Sep 2007 18:05:30 -0000 1.3
@@ -1,4 +1,4 @@
-//$Id: IndexerService.java,v 1.2 2007/07/16 15:11:38 gavin Exp $
+//$Id: IndexerService.java,v 1.3 2007/09/06 18:05:30 ebernard Exp $
package actions;
import java.util.List;
@@ -7,6 +7,7 @@
import javax.persistence.EntityManager;
import org.hibernate.search.FullTextSession;
+import org.hibernate.search.jpa.FullTextEntityManager;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Destroy;
@@ -26,14 +27,13 @@
public class IndexerService
{
@In
- private EntityManager entityManager;
+ private FullTextEntityManager entityManager;
@Create
public void index() {
List blogEntries = entityManager.createQuery("select be from BlogEntry be").getResultList();
- FullTextSession session = (FullTextSession) entityManager.getDelegate();
for (Object be : blogEntries) {
- session.index(be);
+ entityManager.index(be);
}
}
1.8 +5 -4 jboss-seam/examples/blog/src/actions/SearchService.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SearchService.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/blog/src/actions/SearchService.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- SearchService.java 16 Jul 2007 15:11:38 -0000 1.7
+++ SearchService.java 6 Sep 2007 18:05:30 -0000 1.8
@@ -11,6 +11,7 @@
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.queryParser.QueryParser;
import org.hibernate.search.FullTextSession;
+import org.hibernate.search.jpa.FullTextEntityManager;
import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
@@ -27,7 +28,7 @@
{
@In
- private EntityManager entityManager;
+ private FullTextEntityManager entityManager;
private String searchPattern;
@@ -59,10 +60,10 @@
{
return null;
}
- FullTextSession session = (FullTextSession) entityManager.getDelegate();
- return session.createFullTextQuery(luceneQuery, BlogEntry.class)
+
+ return entityManager.createFullTextQuery(luceneQuery, BlogEntry.class)
.setMaxResults(100)
- .list();
+ .getResultList();
}
}
More information about the jboss-cvs-commits
mailing list