All,
The project I am currently working on involves the generation of cfg.xml and hbm.xml files from the DB schema. There is one table called p_d_intervals and it describes the available intervals of time. It contains only 4 rows, no foreign keys and an auto-generated primary key.
Then, there is a p_d_log table that contains log entries. This table has a column that is a foreign key referring to the p_d_interval.id.
The problem is that whenever I try to generate the schema. it produces two object links in between the table. Each log entry contains one interval type which refers to the interval of time for the log entry. This is correct. Then, there is a field in the interval type that is a SET containing all log entries of that interval type. This would make sense in reality, but not with our object model. This is an unnecessary waste of space. How do i remove this from my object model without affecting the DB schema????
Please note that this is my first trial at hibernate.
I am using the Bauer/King Java Persistence with Hibernate (Manning). I noticed that in the only real example for reverse engineering, they do not fully demonstrate how to block bi-directional object mapping, because it is a self-referring table. The example FROM THE BOOK is here:
Code:
<foreign-key constraint-name="FK_NEXT_MESSAGE">
<many-to-one property="nextMessage"/>
<set exclude="true"/> <!-- I AM GUESSING: this needs to be in my code somewhere, but where?? -->
</foreign-key>
appropriate excerpt from MY reveng.xml:
Code:
<table name="pub_disable_log">
<foreign-key constraint-name="pub_disable_log_interval_id_fkey" foreign-table="pub_disable_intervals">
<column-ref local-column="interval_id" foreign-column="ID"/>
<many-to-one property="interval"/>
</foreign-key>
</table>
<table name="pub_disable_intervals">
<!-- WHAT GOES HERE??? -->
</table>
Thanks for any and all help you may provide.
-Hiren
-EMAIL: hhiranan AT gmail DOT com
PS. I am at work and currently dealing with the issue, so any and all assistance whenever possible is much appreciated. Thanks again.