Package org.hibernate.search

Examples of org.hibernate.search.FullTextSession.createCriteria()


    s = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser("id", new StopAnalyzer() );
    List result = s.createFullTextQuery( parser.parse( "body:write" ) ).list();
    assertEquals( 0, result.size() );
    result = s.createCriteria( Email.class ).list();
    for (int i = 0 ; i < loop/2 ; i++)
      s.index( result.get( i ) );
    tx.commit(); //do the process
    s.index( result.get(loop/2) ); //do the process out of tx
    tx = s.beginTransaction();
View Full Code Here


   @SuppressWarnings("unchecked")
   private void indexProducts()
   {
       FullTextSession fullTextSession = getFullTextSession();
       List results = fullTextSession.createCriteria(Product.class)
            .setFetchMode("actors", FetchMode.JOIN)
            .setFetchMode("categories", FetchMode.JOIN)
            .list();
      for (Object obj : results)
      {
View Full Code Here

   private void indexAllClasses(Class... entityTypes)
   {
      FullTextSession fullTextSession = getFullTextSession();
      for (Class entityType : entityTypes)
      {
         for (Object obj : fullTextSession.createCriteria(entityType).list())
         {
            fullTextSession.index(obj);
         }
      }
   }
View Full Code Here

  public void testUpdatingInTransaction() {
    assertFindsByRoadName( "buonarroti" );
    FullTextSession fullTextSession = Search.getFullTextSession( sessions.openSession() );
    try {
      Transaction tx = fullTextSession.beginTransaction();
      List list = fullTextSession.createCriteria( BusStop.class ).list();
      assertNotNull( list );
      assertEquals( 4 , list.size() );
      BusStop busStop = (BusStop) list.get( 1 );
      busStop.setRoadName( "new road" );
      tx.commit();
View Full Code Here

 
  public void testUpdatingOutOfTransaction() {
    assertFindsByRoadName( "buonarroti" );
    FullTextSession fullTextSession = Search.getFullTextSession( sessions.openSession() );
    try {
      List list = fullTextSession.createCriteria( BusStop.class ).list();
      assertNotNull( list );
      assertEquals( 4 , list.size() );
      BusStop busStop = (BusStop) list.get( 1 );
      busStop.setRoadName( "new road" );
      fullTextSession.flush();
View Full Code Here

        em = emf.createEntityManager();
    }

    private void index() {
        FullTextSession ftSession = org.hibernate.search.Search.getFullTextSession((Session) em.getDelegate());
        List results = ftSession.createCriteria(Book.class).list();
        for (Object obj : results) {
            ftSession.index(obj);
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.