I want to work with my database using entiies and jpa.
When i am just trying to create bean in SpringConfig.java:
@Bean
@Singleton
public EntityManager getEntityManager(){
return Persistence.createEntityManagerFactory("collection").createEntityManager();
}
I have:
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named collection: No META-INF/persistence.xml was found in classpath.
But name "collection" is the same as in persistence-unit name
my persistence.xml is in resources (src/main/resources) and configured as jpa in spring boot
UPDATE:
When i am trying to put persistence.xml in resources/META-INF/ I have another exception:
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named collection: Provider named org.hibernate.jpa.HibernatePersistenceProvider threw unexpected exception at create EntityManagerFactory:
java.lang.NoSuchMethodError