Java 类javax.persistence.PersistenceUtil 实例源码
项目:springJpaKata
文件:ProxyTest.java
@Test
public void shouldRetrieveRef(){
Person p = em.getReference(Person.class, 1l);
p.setLastName("ronak");
Assertions.assertThat(p.getClass()).isNotInstanceOf(Person.class);
Assertions.assertThat(p.getId()).isEqualTo(1l);
PersistenceUtil persistenceUtil = Persistence.getPersistenceUtil();
log.info("{}",persistenceUtil.isLoaded(p));
}
项目:springJpaKata
文件:ProxyTest.java
@Test
public void shouldRetrieveFind(){
Person p = em.find(Person.class, 1l);
p.setLastName("ronak");
Assertions.assertThat(p.getClass()).isNotInstanceOf(Person.class);
Assertions.assertThat(p.getId()).isEqualTo(1l);
PersistenceUtil persistenceUtil = Persistence.getPersistenceUtil();
log.info("{}",persistenceUtil.isLoaded(p));
}
项目:jbulletin
文件:SchoolDao.java
public List<School> findall () {
System.out.println("loading schools from table SCHOOL");
List <School> schools = (List<School>) em.createQuery("select s from School s").getResultList();
PersistenceUtil util = Persistence.getPersistenceUtil();
boolean isObjectLoaded = util.isLoaded(schools.get(0));
boolean isManaged = em.contains(schools.get(0));
//force lazy loading befor the end of the session
schools.get(0).getAcademicYears().get(0).getYear();
return schools;
}
项目:evosuite
文件:MockPersistence.java
public static PersistenceUtil getPersistenceUtil() {
return Persistence.getPersistenceUtil();
}
项目:werval
文件:JPA.java
public PersistenceUtil util()
{
return Persistence.getPersistenceUtil();
}