Ideally, packageToScan should work.
Ex -
<property name="packagesToScan" value="tutorials.core.models.entities"></property>
If this is not the case, you can try something like this. (according to the docs, this is the default path)
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"></property>
...
</bean>
After that, you should add persistence.xml to META-INF (in the src / main / resources section)
Ex -
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
version="1.0">
<persistence-unit name="studentPersistenceUnit" transaction-type="RESOURCE_LOCAL" >
<class>tutorials.models.entities.Student</class>
</persistence-unit>
</persistence>
thank
source
share