Home > Blockchain >  Spring/Hibernate: Entity is not mapped
Spring/Hibernate: Entity is not mapped

Time:10-19

I'm doing a Spring/Hibernate MVC CRUD project (which can be found here: Folder and package structure

CodePudding user response:

<context:component-scan .../> has nothing to do with Entity scanning. You should leave it as you have it

<context:component-scan base-package="base_package.de" />

Going through your github repo the answer is in spring-mvc-crud-demo-servlet.xml and more specifically in the declaration of sessionFactory. There you have a property named packagesToScan and this property should be set to the package of your Entities and not to "controller" as it is right now.

<property name="packagesToScan" value="base_package.de.entity" />
  • Related