Package javax.persistence

Examples of javax.persistence.EntityManager.clear()


        em.persist(ui);
        em.persist(checking);
        em.persist(savings);
        em.getTransaction().commit();
       
        em.clear();
       
        ui = findUserIdentity(em, ui.getId());
       
        m = ui.getMember();
        resetSQL();
View Full Code Here


      assertThat( blogEntry.getBlog().getTitle() ).isNotEmpty();
    }
    System.out.printf( "Reading %s took %sms ie %sns/entry\n", nbr_of_reads,
        ( System.nanoTime() - start ) / 1000000, ( System.nanoTime() - start ) / ( nbr_of_reads ) );
    getTransactionManager().commit();
    em.clear();
    start = System.nanoTime();
    int blogReads = nbrOfAuthors * 10;
    if ( blogReads > 10000 ) {
      blogReads = 10000;
    }
View Full Code Here

      assertThat( blog.getId() ).isEqualTo( primaryKey );
      assertThat( blog.getEntries() ).isNotNull();
      if ( blog.getEntries().size() < ( nbrOfBlogEntries / nbrOfAuthors ) / 10 ) {
        System.out.printf( "Small number of entries in this collection %s\n", blog.getEntries().size() );
      }
      em.clear();
      getTransactionManager().commit();
    }
    System.out.printf( "Reading from blog %s times took %sms ie %sns/entry\n", blogReads,
        ( System.nanoTime() - start ) / 1000000, ( System.nanoTime() - start ) / blogReads );
    em.close();
View Full Code Here

      operationSuccessful = true;
    }
    finally {
      commitOrRollback( operationSuccessful );
    }
    em.clear();
    getTransactionManager().begin();
    operationSuccessful = false;
    try {
      News news = em.find( News.class, newsOgmID );
      assertThat( news ).isNotNull();
View Full Code Here

      assertThat( news.getNewsId().getTitle() ).isEqualTo( titleOGM );
      assertThat( news.getLabels().size() ).isEqualTo( newsOgmLabels.size() );
      em.remove( news );
      assertThat( em.find( News.class, newsOgmID ) ).isNull();

      em.clear();
      news = em.find( News.class, newsAboutJugID );
      assertThat( news ).isNotNull();
      assertThat( news.getContent() ).isEqualTo( contentAboutJUG );
      assertThat( news.getNewsId().getAuthor() ).isEqualTo( author );
      assertThat( news.getNewsId().getTitle() ).isEqualTo( titleAboutJUG );
View Full Code Here

      assertThat( news.getNewsId().getTitle() ).isEqualTo( titleAboutJUG );
      assertThat( news.getLabels().size() ).isEqualTo( newsAboutJugLabels.size() );
      em.remove( news );
      assertThat( em.find( News.class, newsAboutJugID ) ).isNull();

      em.clear();
      news = em.find( News.class, newsCountJugID );
      assertThat( news ).isNotNull();
      assertThat( news.getContent() ).isEqualTo( contentCountJUG );
      assertThat( news.getNewsId().getAuthor() ).isEqualTo( author );
      assertThat( news.getNewsId().getTitle() ).isEqualTo( titleCountJUG );
View Full Code Here

        d.setEmployees(emps);
       
        em.getTransaction().begin();
        em.persist(d);
        em.getTransaction().commit();
        em.clear();
       
        resetSQL();
       
        // build a list of public proxy methods
        // exclude those methods that are certain not to cause a load
View Full Code Here

        em.getTransaction().begin();
        em.persist(entity);
        em.getTransaction().commit();

        em.clear();
        PropertyAccessCapitalization persistentEntity = em.find(PropertyAccessCapitalization.class, entity.getId());
        assertEquals(entity, persistentEntity);
    }

    public void testOldCapitalization() {
View Full Code Here

      }
    }
    em.persist(lib);
    em.getTransaction().commit();

    em.clear();
        assertSQLFragnments(sql, "CREATE TABLE DI_LIBRARY1", "LIBRARY_NAME");
        assertSQLFragnments(sql, "CREATE TABLE DI_BOOK1", "LIBRARY_NAME", "BOOK_NAME");
        assertSQLFragnments(sql, "CREATE TABLE DI_PAGE1", "LIBRARY_NAME", "BOOK_NAME", "PAGE_NUM");
        assertSQLFragnments(sql, "CREATE TABLE DI_LINE1", "LIBRARY_NAME", "BOOK_NAME", "PAGE_NUM", "LINE_NUM");
        em.close();
View Full Code Here

            List resultList = q1.getResultList();
            assertNotNull(resultList);
           
            List <EParent> pList = new ArrayList<EParent>();
            pList.addAll(resultList);
            em.clear();                     
            assertNotEquals(0, pList.size());
           
            EParent pFind = pList.get(0);
           
            assertNotNull(pFind);
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.