Figured it out .. here is some code ...
Code:
<many-to-one name="parentContent"
cascade="none"
outer-join="false"
foreign-key="FK1_PARENT_CONTENT_ID">
<column name="parent_content_id"
not-null="false"
unique-key="UNIQUE_NAME_AT_LEVEL"/>
</many-to-one>
<set name="childContents" cascade="all-delete-orphan" lazy="false" inverse="true">
<key column="parent_content_id"/>
<one-to-many class="com.tricision.maas.domain.Content"/>
</set>
this generates the data structure ... (MySQL database)
Quote:
+-------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+----------------+
| content_id | bigint(20) | NO | PRI | NULL | auto_increment |
| content_type_id | bigint(20) | YES | | NULL | |
| content_title | varchar(255) | YES | | NULL | |
| content_text | varchar(255) | YES | | NULL | |
| is_active | bit(1) | YES | | NULL | |
| create_dt | datetime | YES | | NULL | |
| create_user | varchar(255) | YES | | NULL | |
| update_dt | datetime | YES | | NULL | |
| update_user | varchar(255) | YES | | NULL | |
| project_id | bigint(20) | NO | MUL | NULL | |
| parent_content_id | bigint(20) | YES | UNI | NULL | |
+-------------------+--------------+------+-----+---------+----------------+