繁体   English   中英

是否可以让 Hibernate 忽略架构验证列类型不匹配错误

[英]Is it possible to have Hibernate ignore the Schema Validation column type mismatch error

我正在更新我的应用程序正在使用的数据库。 旧模式在诸如 id 之类的东西中大量使用了 short,但新模式已将所有这些更新为 int。 使用我拥有的代码库几乎不可能为这些映射使用功能切换。 我想编写代码以便能够将旧数据库和新数据库用于测试目的。 我可以关闭 Hibernate 中的 Schema 错误列类型异常,只允许将 db 中的 short 映射到代码中的 int 吗?

SchemaManagementException: Schema-validation: wrong column type encountered in 
column [AddressTypeID] in table [dbo.AddressType]; found [smallint 
(Types#SMALLINT)], but expecting [int (Types#INTEGER)

我认为唯一的解决方案是切换到关闭hbm2ddl

hibernate.hbm2ddl.auto=none

none休眠跳过模式验证

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM