Springboot+hibernate5:一个Entity出现两个表的问题
来源:互联网 发布:在国外注册域名 编辑:程序博客网 时间:2024/05/23 22:00
问题:
未声明命名规则,hibernate.hbm2ddl.auto=update。
@Entity
public class UserInfo implements Serializable
数据库中出现两个表:userinfo和user_info,表中字段与Entity中字段完全一样。
原因:
hibernate5中,原来的hibernate.naming-strategy不再被支持,而用hibernate.naming.implicit_naming_strategy=org.hibernate.boot.model.naming.SpringPhysicalNamingStrategy或hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl代替。
SpringPhysicalNamingStrategy与hibernate4中ImprovedNamingStrategy相同,PhysicalNamingStrategyStandardImpl与hibernate4中DefaultNamingStrategy相同。
Springboot对hibernate5采用的默认配置是SpringPhysicalNamingStrategy。
解决方案:
hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
或者显式声明表名(@Table(name=“user_info”))
- Springboot+hibernate5:一个Entity出现两个表的问题
- Hibernate5 第一个程序的问题Unknown entity
- hibernate5.2.4做多表查询时出现异常的相关问题
- 使用springboot+maven出现的问题
- springBoot JPA 查询中出现的问题
- 解决hibernate5不能自动生成表的问题
- (自己使用Hibernate出现的版本问题)Eclipse上使用Hibernate5.0及以上版本编写!
- Cmake出现的两个问题
- hibernate的反向生成entity出现一个abstract
- Hibernate5 Unknown entity错误解决方法
- 关于hibernate5的一个小改动
- Entity Framework访问数据库时出现的问题
- nginx 出现413 Request Entity Too Large问题的解决方法
- nginx 出现413 Request Entity Too Large问题的解决方法
- nginx 出现413 Request Entity Too Large问题的解决方法
- nginx 出现413 Request Entity Too Large问题的解决方法
- 出现 Request Entity Too Large问题的解决方法
- nginx 出现413 Request Entity Too Large问题的解决方法
- 2.5 Git 基础 - 远程仓库的使用
- 解决Windows记事本打开Linux程序注释乱码排版混乱的问题
- VIew-CoordinatorLayout 笔记
- Oracle建立表空间和用户
- Spring注解详解
- Springboot+hibernate5:一个Entity出现两个表的问题
- 【备忘】黑马程序员_黎活明_Android核心基础视频教程 下载
- Slice2cpp编译的报头文件无法打开的错误
- 【STL】set
- Description of CORS Issue
- 【转】如何撤销git reset --hard操作
- 图像检索服务器编写问题记录——添加线程池
- Deep learning
- sublime text2 设置默认浏览器