Posts

Showing posts from December 23, 2018

spring boot and hibernate 5 - EntityManagerFactory session management

Image
0 I'm working on my first web app with Spring-boot and hibernate. I've written my first DAO like this : package myapplication.orderinfo; import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.persistence.EntityManagerFactory; import javax.persistence.TypedQuery; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; @Component public class OrderInfoDaoImpl implements OrderInfoDao { @Autowired private EntityManagerFactory entityManagerFactory; public List<OrderInfo> getOrderInfoDetails() {