2
Когда я пытаюсь начать транзакциюUnsupportedOperationException: приложение должно предоставить JDBC соединения JPA Hibernate Spring JDBC
entityManager.getTransaction().begin();
в AbstractDao, я получаю
java.lang.UnsupportedOperationException: The application must supply JDBC connections
Мой persistence.xml
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="pu" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value = "create-drop"/>
</properties>
</persistence-unit>
</persistence>
My hibernate.properties
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ewp?createIfNotExist=true
jdbc.username=root
jdbc.password=root
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hibernate.format_sql=false
hibernate.hbm2ddl.auto=create-drop
EntityManagerFactory боб:
@Bean
public EntityManagerFactory entityManagerFactory(){
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("pu");
return entityManagerFactory;
}
EntityManager боб:
@Bean
public EntityManager entityManager(){
return entityManagerFactory.createEntityManager();
}