I\'m using eclipse juno IDE I have Java application which have src folder. within the folder I have:
1) applicationContext.xml
2) persistence.xml
I a
Your attempt to use persistence.xml
as a Spring config makes absolutely no sense, because persistence.xml
is not a Spring config.
If you want to use JPA with Spring, you need to put persistence.xml
into META-INF
folder inside your source folder, and declare LocalContainerEntityManagerFactory
in applicationContext.xml
:
Then you can inject EntityManager
into your Spring bean using @PersistenceContext
:
@PersistenceContext
private EntityManager em;
See also: