Package org.hibernate.search

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


    // now creating and deleting the "same" (as by pk) entity several times in same transaction:
    {
      session.beginTransaction();
      session.persist( new Domain( 8, "mysql.org" ) );
      Domain mysqlDomain = (Domain) session.load( Domain.class, 8 );
      session.delete( mysqlDomain );
      Domain newDomain = new Domain( 8, "something.org" );
      session.persist( newDomain );
      session.delete( newDomain );
      session.persist( new Domain( 8, "somethingnew.org" ) );
View Full Code Here


      tx = fullTextSession.beginTransaction();
      for ( int i = 0; i < amount; i++ ) {
        TitleAble instance = entityType.newInstance();
        instance.setTitle( sentenceInventor.nextSentence() );
        //to test for HSEARCH-512 we make all entities share some proxy
        Nation country = (Nation) fullTextSession.load( Nation.class, 1 );
        instance.setFirstPublishedIn( country );
        fullTextSession.persist( instance );
        totalEntitiesInDB++;
        if ( i % 250 == 249 ) {
          tx.commit();
View Full Code Here

  private static void storeAllBooksInNation() {
    FullTextSession fullTextSession = builder.openFullTextSession();
    try {
      Transaction tx = fullTextSession.beginTransaction();
      List<Book> allBooks = fullTextSession.createCriteria( Book.class ).list();
      Nation italy = (Nation) fullTextSession.load( Nation.class, 1 );
      italy.getLibrariesHave().addAll( allBooks );
      tx.commit();
    }
    finally {
      fullTextSession.close();
View Full Code Here

    LeakingLuceneBackend.reset();
    fullTextSession.clear();

    // now change the BusLine in some way which does not affect the index:
    tx = fullTextSession.beginTransaction();
    line1 = (BusLine) fullTextSession.load( BusLine.class, line1.getId() );
    line1.setBusLineCode( 2 );
    line1.setOperating( true ); // boolean set to same value: might receive a different instance of Boolean
    BusStop busStop = line1.getStops().iterator().next();
    busStop.setServiceComments( "please clean the garbage after the football match" );
    tx.commit();
View Full Code Here

    // now we make an indexing affecting change in the embedded object only,
    // parent should still be updated
    LeakingLuceneBackend.reset();
    fullTextSession.clear();
    tx = fullTextSession.beginTransaction();
    busStop = (BusStop) fullTextSession.load( BusStop.class, busStop.getId() );
    busStop.setRoadName( "Mill Road" );
    tx.commit();
    Assert.assertEquals( 1, LeakingLuceneBackend.getLastProcessedQueue().size() );

    LeakingLuceneBackend.reset();
View Full Code Here

    Assert.assertEquals( 1, LeakingLuceneBackend.getLastProcessedQueue().size() );

    LeakingLuceneBackend.reset();
    fullTextSession.clear();
    tx = fullTextSession.beginTransaction();
    busStop = (BusStop) fullTextSession.load( BusStop.class, busStop.getId() );
    //verify mutable property dirty-ness:
    busStop.getStartingDate().setTime( 0L );
    tx.commit();
    Assert.assertEquals( 1, LeakingLuceneBackend.getLastProcessedQueue().size() );
View Full Code Here

   */
  private void renamePerson(Long id, String newName) {
    FullTextSession fullTextSession = Search.getFullTextSession( openSession() );
    try {
      Transaction transaction = fullTextSession.beginTransaction();
      Person kingJohn = (Person) fullTextSession.load( Person.class, id );
      kingJohn.setName( newName );
      transaction.commit();
    }
    finally {
      fullTextSession.close();
View Full Code Here

  @Test
  public void testMultipleUpdatesTriggeredByContainedIn() {
    PersonalContact contact = createTestData();
    FullTextSession s = Search.getFullTextSession( openSession( ) );
    s.getTransaction().begin();
    contact = (PersonalContact) s.load( PersonalContact.class, contact.getId() );
    contact.setEmail( "spam@hibernate.org" );
    s.getTransaction().commit();
    s.close();
  }
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.