Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate Tools "Duplicate class" error on reverse engineering

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

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‌​)'
like image 539
Daniil Shevelev Avatar asked Jul 11 '13 12:07

Daniil Shevelev


2 Answers

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).

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

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

Configure with reveng.xml

Add necessary variables

like image 72
Dimitri Dewaele Avatar answered Sep 28 '22 11:09

Dimitri Dewaele


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.

like image 20
Daniil Shevelev Avatar answered Sep 28 '22 10:09

Daniil Shevelev