SpringBoot报错has an unbound type and no explicit target entity.

Posted 后端研发Marion

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringBoot报错has an unbound type and no explicit target entity.相关的知识,希望对你有一定的参考价值。


一、问题描述

Error starting ApplicationContext. To display the conditions report re-run your application with debug enabled.
21-05-18 11:19:39.174 ERROR [main] o.springframework.boot.SpringApplication:837 - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name entityManagerFactory defined in class path resource [com/xxx/config/DatabaseConfig.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Property com.xxx.entity.base.BaseEntity.id has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1794)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1109)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at com.easylive.mgs.appcore.Application.main(Application.java:12)
Caused by: org.hibernate.AnnotationException: Property com.easylive.mgs.appcore.entity.base.BaseEntity.id has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type
at org.hibernate.cfg.PropertyContainer.assertTypesAreResolvable(PropertyContainer.java:243)
at org.hibernate.cfg.PropertyContainer.getProperties(PropertyContainer.java:233)
at org.hibernate.cfg.AnnotationBinder.addElementsOfClass(AnnotationBinder.java:1506)
at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:222)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:779)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:254)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:230)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:273)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1224)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1255)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)
... 17 common frames omitted

Process finished with exit code 1

 

以上是关于SpringBoot报错has an unbound type and no explicit target entity.的主要内容,如果未能解决你的问题,请参考以下文章

IE11 F12工具报错 An error has occurredJSPlugin.3005

启动ecilpse 报错an error has occurred. see the log file

Myeclipse启动报错:An error has occurred.See the log file

FastLane自动化打包报错: An exception has occurred: issuerId is required

FastLane自动化打包报错: An exception has occurred: issuerId is required

Myeclipse运行报错:an out of memory error has occurred的解决方法