I try to use Spring+JPA+Hibernat
e and try to inject EntityManagerFactory
,and later create EntityManger in my code.But when I use entityManager.persist(user)
,the user
not saving to the database
.But when I try to inject the EntityManager
instead of EntityManagerFactory
,it worked !,I do not know where is the problem.
you can also see this question for more code.