迁移到Hibernate 5.x [英] Migrating to Hibernate 5.x
问题描述
我将应用程序从Hibernate 3迁移到Hibernate 5.我们使用 DatabaseMetadata
类来获取 TableMetadata
。因此,使用 TableMetadata
对象来获取数据库表列信息,如列大小,类型等。看起来在Hibernate 5中, DatabaseMetadata
类被弃用(删除!)。 Hibernate 5中有没有其他的替代方案可用于 DatabaseMetadata
类?或者如何在Hibernate 5 env中获得 TableMetadata
?
它在我们转向采用模式工具的新方法时,我们在5.0中被删除了。 DatabaseMetadata表示来自底层数据库的现有目录/模式信息。在5.0中,该角色由 org.hibernate.tool.schema.extract.spi.DatabaseInformation
提供。这个(以及它之前的DatabaseMetadata)确实仅用于模式验证和模式迁移(更新)代码。它被传入这些电话。我假设你正在使用这是一种不同的方式。这不一定是支持的,但如果你想继续,那么你只需实例化一个 org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl
实例。 / p>
I am migrating my application to Hibernate 5 from Hibernate 3. We are using DatabaseMetadata
class to get TableMetadata
. Hence using TableMetadata
object to get DB table column information like column size, type..etc. It seems in Hibernate 5 DatabaseMetadata
class got deprecated (removed!). Are there any alternatives for DatabaseMetadata
class in Hibernate 5? Or else how to get TableMetadata
in Hibernate 5 env?
It got removed in 5.0 as we moved to a new approach to schema tooling. DatabaseMetadata represented the existing catalog/schema information from the underlying database. In 5.0 that role is served by org.hibernate.tool.schema.extract.spi.DatabaseInformation
. That (and DatabaseMetadata before it) are really supported just for use in schema validation and schema migration (update) code. It is passed into those calls. I assume you are using this is a different way. That is not necessarily supported, but if you want to continue that anyway, you'd just instantiate a org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl
instance.
这篇关于迁移到Hibernate 5.x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!