Hello,
I'm building hbm.xml files with a JDBC Configuration using hibernate tools, but facing a bunch of problems here.
Hope any can help with this.
1. Failing to take care of composite primary keys and Foreign keys
here in a particular table "account_details" [Primary key contains - (id, household_account_id,affiliate_scheme_id)] exporter fails due to an error saying -
Code:
`Foreign key (FK1419A630FE819854:account_details [household_account_id])) must have same number of columns as the referenced primary key (account_details [id,household_account_id,affiliate_scheme_id])`
on table account_details i have a FK - household_account_id referencing `player_id` (account_details)
ie.
FOREIGN KEY (`household_account_id` )
REFERENCES `account_details` (`player_id` )
here the thing is i have unique indexes for the table which do not get mapped and then i would like to use this association with hibernate as this exists in multiple tables. Is there a way around this ? Can write hbm.xml files for such tables but I do not want to have to run the tool everytime i want to find out all the tables with problems. the schema is like pretty big here.
Also straightforward instances of FK's are getting mapped okay without any problems.
Details -
hibernate-3.2.6.ga
HibernateTools-3.2.4.GA
mysql-connector-java-5.1.10
java 1.6
from hibernate.cfg.xml -
Code:
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/zenfox</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
from ant task -
Code:
<hibernatetool destdir="${build.dir}">
<jdbcconfiguration
packagename="base"
configurationfile="hibernate.cfg.xml"
revengfile="hibernate.reveng.xml"
detectmanytomany="true" />
<!-- detectoptmisticlock="true" -->
<hbm2hbmxml destdir="${build.dir}"/>
</hibernatetool>
I'm sure this is a pretty common issue though oddly enough i found very few references to this, has anyone run across this before ?