将 entity 单独放在一个项目中,打包成 abc.jar 放到web项目中,提示 错误
aused by: java.lang.IllegalArgumentException: Not an entity: class com.classify.model.Classify
at org.hibernate.ejb.metamodel.MetamodelImpl.entity(MetamodelImpl.java:179)
at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:52)
at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getMetadata(JpaEntityInformationSupport.java:61)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:145)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:83)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:66)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:146)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:120)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.getObject(RepositoryFactoryBeanSupport.java:39)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
... 65 more
解决方法
参考:
https://forum.hibernate.org/viewtopic.php?f=1&t=1008811
Finally found out how to do this.. Got some help over at stackoverflow:
http://stackoverflow.com/questions/5064 ... wo-webapps
Seems there are two ways to solve it:
1) Specify the entity jar file in persistence.xml: <jar-file>common.jar</jar-file>
2) List all entities by class name in persistence.xml using <class>com.mycompany.model.Locale</class>
We
ended up using the second approach. I couldn't get the first approach
working when deploying with eclipse, and it would also require us to
update the persistence.xml each time version numbers change (since we
build with maven). Any solutions to these problems?
Anyway, so happy we finally figured this one out.
-Anders
分享到:
相关推荐
标签:springframework、data、spring、jpa、中文文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和说明...
Spring Data JPA原理.pptx
仓库管理系统,SpringBoot+Spring Data JPA.zip仓库管理系统,SpringBoot+Spring Data JPA.zip仓库管理系统,SpringBoot+Spring Data JPA.zip仓库管理系统,SpringBoot+Spring Data JPA.zip仓库管理系统,SpringBoot...
5-Spring-Boot(五):spring data jpa的使用.docx5-Spring-Boot(五):spring data jpa的使用.docx5-Spring-Boot(五):spring data jpa的使用.docx5-Spring-Boot(五):spring data jpa的使用.docx5-Spring-Boot(五):...
仓库管理系统,SpringBoot+Spring Data JPA+.....
用SpringBoot + Spring Data JPA操作数据库 项目启动的时候 报了一个错 SpringBoot的版本是2.2.6.RELEASE org.springframework.beans.factory.BeanCreationException: Error creating bean with name '...
spring注解完整版+spring data jpa官方文档中文翻译+JPA2.0官方文档 文档内容齐全 值得参考学习
标签:springframework、data、spring、jpa、中英对照文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档内容。 人性化翻译,文档中的代码和结构保持不变,注释和...
管理系统系列--仓库管理系统,SpringBoot+Spring Data JPA+.....
Spring Data JPA 是 Spring 基于 ORM 框架、JPA 规范的基础上封 装的一套 JPA 应用框架,可使开发者用极简的代码即可实现对数据库 的访问和操作。它提供了包括增删改查等在内的常用功能,且易于扩 展!学习并使用 ...
Spring Data JPA API。 Spring Data JPA 开发文档。 官网 Spring Data JPA API。
仓库管理系统,SpringBoot+Spring Data JPA+.zip
spring data jpa最新版本1.8.0,包含了spring-data-jpa-1.8.0.RELEASE.jar,spring-data-jpa-1.8.0.RELEASE-javadoc.jar以及 spring-data-jpa-1.8.0.RELEASE-sources.jar文档和源代码
在Spring Boot 2.x版本中可以非常轻松、快速搞定持久层的开发动作,配置比SpringBoot+MyBatis还少,偶觉得它除了执行效果不如MyBatis外,在使用效率的情况下,使用Spring Data JPA的开发速度会比较MyBatis还快。...
'SpringDataJPA从入门到精通'分为12章 内容包括整体认识JPA、JPA基础查询方法、定义查询方法、注解式查询方法、@Entity实例里面常用注解详解、JpaRepository扩展详解、JPA的MVC扩展REST支持、DataSource的配置、乐观...
技术架构:SpringMVC3+Spring3.1.2+Spring Data JPA+Maven 声明:该应用仅仅是技术研究:Spring Data JPA的配置和常见api的使用&maven构建项目,其他技术不在此研究 内涵sql和各种Spring Data JPA测试和案例,导入&...
3. 与Spring全家桶结合紧密: 4. 成熟的框架和架构 常⻅的SQL性能问题,如何优雅处理? 2. 错综复杂的关联关系如何应对? 3. 万恶的LazyException本质是什么? 4. ⾼并发⾼性能要求的API服务要⽤JPA吗?