Hibernate Tools "Duplicate class" error on reverse engineering
Asked Answered
H

3

12

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‌​)'
Hansiain answered 11/7, 2013 at 12:40 Comment(0)
M
19

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

Mcgannon answered 25/7, 2013 at 14:49 Comment(3)
What should i do after clicking on Add Exporter Property ? what should i give for values ??Phil
Selecting the specific Database Schema worked for me!Edge
multiple database schema filter to singleTriangle
H
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.

Hansiain answered 11/7, 2013 at 14:9 Comment(1)
How did you exclude schema please? I am trying in NB8.02 even with explicit schema & explicit tables still get "'validname.CheckConstraints" on db.sys.check_constraint.Selfsatisfied
P
1

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 see picture here

Putrescible answered 4/2, 2018 at 11:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.