逆向工程中的Hibernate Tools“Duplicate class”错误

时间:2021-08-15 10:16:19

I am trying to reverse engineer a SQL Server 2005 using Hibernate Tools and am getting a strange error:

我正在尝试使用Hibernate Tools对SQL Server 2005进行逆向工程,并且出现了一个奇怪的错误:

org.hibernate.cfg.JDBCBinderException: 
     Duplicate class name 'CheckConstraints' generated for
     'org.hibernate.mapping.Table(e2rm_maintenance_development2.sys.check_constraints‌​)'. 
     Same name where generated for             
     'org.hibernate.mapping.Table(e2rm_maintenance_development2.sys.check_constraints‌​)' 

    Duplicate class name 'CheckConstraints' generated for 
    'org.hibernate.mapping.Table(e2rm_maintenance_development2.sys.check_constraints‌​)'. 
    Same name where generated for 
    'org.hibernate.mapping.Table(e2rm_maintenance_development2.sys.check_constraints‌​)'

3 个解决方案

#1


11  

A development user has typically access to multiple database schema s with similar tables. The Generation tool tries to generate output for all those databases and this results in duplicate class names (even if you ask for ddl generation).

开发用户通常可以访问具有类似表的多个数据库模式。生成工具尝试为所有这些数据库生成输出,这会导致重复的类名称(即使您要求生成ddl)。

Add a 'reveng' setup and limit the output to one database schema.

添加'reveng'设置并将输出限制为一个数据库模式。

Also add necessary parameters from the selected 'Exporters'. Some are necessary, but this is not indicated in the overview.

还可以从选定的“导出器”中添加必要的参数。有些是必要的,但概述中未说明。

逆向工程中的Hibernate Tools“Duplicate class”错误

逆向工程中的Hibernate Tools“Duplicate class”错误

#2


4  

I was able to avoid the error by creating "hibernate.reveng.xml" in which I excluded "sys" and "INFORMATION" schemas and only included "dbo" schema.

我能够通过创建“hibernate.reveng.xml”来避免错误,其中我排除了“sys”和“INFORMATION”模式,并且只包含“dbo”模式。

#3


0  

as a continue to Daniil Shevelev answer (this is what worked for me ) in order to exlude schema add new reveng.xml then choose new and on the next screen click next -then click refresh on the buttom (takes some time to get the schemas) then stand on the relevant scheme and exclude it 逆向工程中的Hibernate Tools“Duplicate class”错误

作为继续Daniil Shevelev的回答(这对我有用)为了排除架构添加新的reveng.xml然后选择新的并在下一个屏幕上单击下一步 - 然后单击刷新按钮(需要一些时间来获取模式然后站在相关计划上并将其排除在外

#1


11  

A development user has typically access to multiple database schema s with similar tables. The Generation tool tries to generate output for all those databases and this results in duplicate class names (even if you ask for ddl generation).

开发用户通常可以访问具有类似表的多个数据库模式。生成工具尝试为所有这些数据库生成输出,这会导致重复的类名称(即使您要求生成ddl)。

Add a 'reveng' setup and limit the output to one database schema.

添加'reveng'设置并将输出限制为一个数据库模式。

Also add necessary parameters from the selected 'Exporters'. Some are necessary, but this is not indicated in the overview.

还可以从选定的“导出器”中添加必要的参数。有些是必要的,但概述中未说明。

逆向工程中的Hibernate Tools“Duplicate class”错误

逆向工程中的Hibernate Tools“Duplicate class”错误

#2


4  

I was able to avoid the error by creating "hibernate.reveng.xml" in which I excluded "sys" and "INFORMATION" schemas and only included "dbo" schema.

我能够通过创建“hibernate.reveng.xml”来避免错误,其中我排除了“sys”和“INFORMATION”模式,并且只包含“dbo”模式。

#3


0  

as a continue to Daniil Shevelev answer (this is what worked for me ) in order to exlude schema add new reveng.xml then choose new and on the next screen click next -then click refresh on the buttom (takes some time to get the schemas) then stand on the relevant scheme and exclude it 逆向工程中的Hibernate Tools“Duplicate class”错误

作为继续Daniil Shevelev的回答(这对我有用)为了排除架构添加新的reveng.xml然后选择新的并在下一个屏幕上单击下一步 - 然后单击刷新按钮(需要一些时间来获取模式然后站在相关计划上并将其排除在外