Migrating to Hibernate 5.x

拜拜、爱过 提交于 2019-12-09 19:24:30

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/33694436/migrating-to-hibernate-5-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!