javahibernatereverse-engineering

Hibernate Duplicate class name exception


I am using Hibernate 3.5, when I do the reverse engineering with SQL 2012 and Hibernate I am getting following error

org.hibernate.cfg.JDBCBinderException: Duplicate class name com.pepspb.entity.CheckConstraints generated for org.hibernate.mapping.Table(pepspb.sys.check_constraints). Same name where generated for org.hibernate.mapping.Table(pepspb.sys.check_constraints)
Duplicate class name 'com.pepspb.entity.CheckConstraints generated for org.hibernate.mapping.Table(pepspb.sys.check_constraints). Same name where generated for org.hibernate.mapping.Table(pepspb.sys.check_constraints)
<No message>

Can any one please tell me what is the reason?


Solution

  • This sometimes happens when you mix the original sources with the generated ones. To resolve the issue you should separate src and gensrc at the module. And don't use gensrc where you have generated classes via reverse engineering as the source folder. Just compare or even better diff them and merge avoiding duplicate classes.