Package org.hibernate.search

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


      throws InstantiationException, IllegalAccessException {
    FullTextSession fullTextSession = builder.openFullTextSession();
    int totalEntitiesInDB = 0;
    try {
      Transaction tx = fullTextSession.beginTransaction();
      fullTextSession.persist( new Nation( "Italy", "IT" ) );
      tx.commit();
      tx = fullTextSession.beginTransaction();
      for ( int i = 0; i < amount; i++ ) {
        TitleAble instance = entityType.newInstance();
        instance.setTitle( sentenceInventor.nextSentence() );
View Full Code Here


        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();
          fullTextSession.clear();
          System.out.println( "Test preparation: " + totalEntitiesInDB + " entities persisted" );
View Full Code Here

    boolean raised = false;
    final Transaction transaction = fts.beginTransaction();
    try {
      Test test = new Test();
      test.setIncorrectType( "not a class" );
      fts.persist( test );
      transaction.commit();
      fail( "An exception should have been raised" );
    }
    catch (Exception e) {
      //good
View Full Code Here

    Item item = new Item();
    item.setPrice( 34.54d );

    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();
    s.persist( item );
    tx.commit();
    s.clear();

    tx = s.beginTransaction();
View Full Code Here

    address.setStreet1( "3340 Peachtree Rd NE" );
    address.setStreet2( "JBoss" );

    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();
    s.persist( address );
    tx.commit();

    s.clear();

    tx = s.beginTransaction();
View Full Code Here

    ent2.setEntity1( ent1 );
    ent1.getEntities2().add( ent2 );

    ent2.setName( "test - 1" );

    fts.persist( ent1 );
    fts.persist( ent2 );

    tx.commit();

    long uid2 = ent2.getUid();
View Full Code Here

    address.setStreet1( "Peachtree Rd NE" );
    address.setStreet2( "JBoss" );

    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();
    s.persist( address );
    tx.commit();

    s.clear();

    tx = s.beginTransaction();
View Full Code Here

    ent1.getEntities2().add( ent2 );

    ent2.setName( "test - 1" );

    fts.persist( ent1 );
    fts.persist( ent2 );

    tx.commit();

    long uid2 = ent2.getUid();
    long uid1 = ent1.getUid();
View Full Code Here

    ent2_1.setEntity1( ent1_1 );
    ent1_1.getEntities2().add( ent2_1 );

    // persist outside the tx
    fts.persist( ent1_0 );
    fts.persist( ent1_1 );
    fts.persist( ent2_0 );
    fts.persist( ent2_1 );

    Transaction tx = fts.beginTransaction();
View Full Code Here

    ent2_1.setEntity1( ent1_1 );
    ent1_1.getEntities2().add( ent2_1 );

    // persist outside the tx
    fts.persist( ent1_0 );
    fts.persist( ent1_1 );
    fts.persist( ent2_0 );
    fts.persist( ent2_1 );

    Transaction tx = fts.beginTransaction();
    tx.commit(); //flush
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.