Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

duplicate generated as a result of foreign keys

Sagar Bilgi
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the middlegen-hibernate plugin.(Middlegen-Hibernate-r4)

Here is a summary of the issue that I am facing.I am trying to use middlegen to read the database schema to autogenerate the hibernate mapping files for me. I am then using hbm2java to convert the mapping files into POJOs.

The schema that I am reading has many tables in it and I have specified the specific tables that I am interested in by using the <table> element tag in the ant specific build.xml file. The appropriate hbm.xml files are generated,however there is an issue with them.

Some of the columns in the tables that I have specified in the xml file are foreign keys in other tables.Middlegen seems to be generating a seperate <meta / property > tag for each of the tables that it references. So if column X in table A is a foreign key in 3 tables. I have the property for column x thrice in my A.hbm.xml file in class A and hence also correspondingly in my POJO I have the attribute declared thrice.

Is there a setting in the middlegen task that I need to turn on. I tried swithching the genIntegratedComposite key in the hibernate task either ways but that doesnt seem to help.

Please advise /provide solution for the same.
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!