diff --git a/framework/hibernate-enhancer/src/main/java/com/example/spring/orm/CLR.java b/framework/hibernate-enhancer/src/main/java/com/example/spring/orm/CLR.java index 73416e38..3d24e828 100644 --- a/framework/hibernate-enhancer/src/main/java/com/example/spring/orm/CLR.java +++ b/framework/hibernate-enhancer/src/main/java/com/example/spring/orm/CLR.java @@ -24,7 +24,6 @@ public class CLR implements CommandLineRunner { } public void lazyLoad(Long id) { - clearCache(); Category result = entityManager.find(Category.class, id); @@ -32,7 +31,6 @@ public class CLR implements CommandLineRunner { } public Long insertTestData() { - Product product = new Product(); product.setName("lazy-loading-works :)"); entityManager.persist(product); @@ -47,7 +45,6 @@ public class CLR implements CommandLineRunner { } void clearCache() { - Session s = (Session) entityManager.getDelegate(); SessionFactory sf = s.getSessionFactory(); sf.getCache().evictEntityData(); diff --git a/framework/hibernate-enhancer/src/main/java/com/example/spring/orm/model/Category.java b/framework/hibernate-enhancer/src/main/java/com/example/spring/orm/model/Category.java index bfeb23b7..de9edd9f 100644 --- a/framework/hibernate-enhancer/src/main/java/com/example/spring/orm/model/Category.java +++ b/framework/hibernate-enhancer/src/main/java/com/example/spring/orm/model/Category.java @@ -13,7 +13,7 @@ public class Category { @GeneratedValue private Long id; - @ManyToOne(fetch = FetchType.LAZY) // + @ManyToOne(fetch = FetchType.LAZY) private Product product; public Category(Product product) {