質問

I wanted to create a Hibernate mapping file from my database for a few tables (not all). How can I achieve this?

When I am trying, it is considering my entire database and crashing without creating any mapping files. It gives me the following error:

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

役に立ちましたか?

解決

You need to setup your reveng.xml to only look at specific tables. The tutorial you mentioned does not cover this. If you click Setup beside reveng.xml (seen in step 3 of that tutorial) you will be taken through a wizard to select what you want.

In the end you should expect to have an xml value like so that restricts to a table you want:

<schema-selection match-schema="COMMON_SCHEMA" match-table="CITY"/>

See the Red Hat site for the exact details on the Hibernate reveng.xml file.

I believe you are getting that exception because of two tables with the same name.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top