Is there way I can modify my hibernate.reveng.xml file for 2tables with composite keys having object references in the POJOs -



Is there way I can modify my hibernate.reveng.xml file for 2tables with composite keys having object references in the POJOs -

<table schema="employees" name="dept_emp"> <primary-key> <generator class="native"> <param name="dept_emp">dept_emp_dept_no_seq</param> </generator> <key-column name="dept_no" /> <key-column name="emp_no" /> </primary-key> <column name="from_date" property="fromdate" type="date" /> <column name="to_date" property="todate" type="date" /> </table> <table schema="employees" name="employees"> <primary-key> <generator class="native"> <param name="employees">employees_emp_no_seq</param> </generator> <key-column name="emp_no" /> </primary-key> <column name="birth_date" property="birthdate" type="date" /> <column name="first_name" property="firstname" type="string" /> <column name="last_name" property="lastname" type="string" /> <column name="gender" property="gender" type="string" /> <column name="hire_date" property="hiredate" type="date" /> </table>

is there way can modify hibernate.reveng.xml file 2tables composite keys having object references in pojos above file reveng.xml need modify automatically generate pojos object reference in them (column name = emp_no)

you can add together below table declarations in reveng.xml pojos generated expected relations.

<table schema="employees" name="dept_emp"> <composite-id name="id" class="com.hrdb.deptempid"> <key-property name="empno" type="string"> <column name="emp_no" length="3" /> </key-property> <key-property name="deptno" type="string"> <column name="dept_no" length="3" /> </key-property> </composite-id> <many-to-one name="employees" class="com.hrdb.employees" update="false" insert="false" fetch="select"> <column name="emp_no" length="3" not-null="true" /> </many-to-one> <column name="from_date" property="fromdate" type="date" /> <column name="to_date" property="todate" type="date" /> </table>

you can utilize git hub project generate hbm file out of database configuration.from hbm file easy build reveng.xml file.

hibernate hibernate-tools

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -