Skip to content
Siminov Framework edited this page Jan 17, 2016 · 6 revisions

Many to One

Many-To-One relationship is in which one entity (typically a column or set of columns) contains values that refer to another entity (a column or set of columns) that has unique values.

Example: In a geography schema having tables Region, State, and City, there are many states that are in a given region, but no states are in two regions.

Many To One Syntax

    <entity-descriptor>

            <relationships>
			
                <relationship>
                    <property name="type">many-to-one</property>
                    <property name="refer">name-of-variable</property>
                    <property name="refer_to">map_to_model_class_name</property>
                    <property name="on_update">cascade/restrict/no_action/set_null/set_default</property>
                    <property name="on_delete">cascade/restrict/no_action/set_null/set_default</property>
                    <property name="load">true/false</property>
                </relationship>		
		    		
            </relationships>		

    </entity-descriptor>