Either use bernate's Session API or JPA's Entitymanager API with but not both.
A) You are defining both a bernate SessionFactory and a JPA EntitymanagerFactory. Which is it going to be? Either use bernate's Session API or JPA's Entitymanager API with but not both.
B) You have defined a bernateTransactionManager, but since you are using EntityManager in your code, you need a JpaTransactionManager instead: pl. M4ks. Comics And a design note: DAOs shouldn't be transactional.
You should use a service layer that manages the transactions. See this question (and many others) for reference.
Very thanks for answer. I tried to edit applicationCOntext. Xml - I just commented entityManagerFactory bean.
Now I get org.springframework.beans.factory. NoSuchBeanDefinitionException: No unique bean of type javax.persistence. EntityManagerFactory is defined: expected single bean but found 0 since I try to use entityManager in my DAO.
– M4ks Mar 21 at 20:22 @M4ks well then you should comment out the SessionFactory, not the EntityManagerFactory – Sean Patrick Floyd Mar 21 at 20:25 I guess so. But how can I perform any database operation without entityManager? – M4ks Mar 21 at 20:27 @M4ks you misunderstood me.
Get rid of the SessionFactory, not the EnitiyManagerFactory. And add JpaTransactionManager. Everything will be fine – Sean Patrick Floyd Mar 21 at 20:32 Works!
I found the difference between Session API and EntityManager. I will stay with second one. Very big thanks to you!
– M4ks Mar 21 at 20:48.
You need to call following method on EntityManager flush() To make actual save in database.
1 That's not correct. If the Spring TransactionManager is set up correctly, entityManager.flush() will be called automatically – Sean Patrick Floyd Mar 21 at 9:45.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.