I am currently having a problem injecting entityFactoryManager into my extended jpadaosupport class.
My configuration is below:
<bean id="productDao" class="springapp.repository.JdbcProductDao">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
The above configuration for this bean works fine, but when I try to use annotations to configure the bean, my application does not work
My JdbcProductDao.java file is below
@Repository("productDao")
@Transactional
public class JdbcProductDao extends JpaDaoSupport implements ProductDao {
@SuppressWarnings("unchecked")
@Override
public List<Product> getProductList() {
return getJpaTemplate().getEntityManagerFactory().createEntityManager()
.createQuery("from Product").getResultList();
}
@Override
public void persist(Product product) {
}
@Override
public void saveProduct(Product prod) {
getJpaTemplate().merge(prod);
}
@Autowired
@Required
public void setJpaEntityManagerFactory(
@Qualifier("entityManagerFactory") EntityManagerFactory entityManagerFactory) {
super.setEntityManagerFactory(entityManagerFactory);
}
}
However, it seems that EntityManagerFactory is not being entered properly, because none of the transactions in my database are visible
Can anyone suggest any kind of understanding?
source
share