Ordered many-to-many association

I’ve got a class diagram with two types “A” and “B”, where A holds an ordered list of B. I’m trying to configure the many-to-many association in the class diagram, where the association is only navigable from A->B and the order of the B instances in the list is given by the order they are added to the list at runtime. This should result in an association table in the erd with the fields a_id, b_id, order_idx, and a hibernate mapping for the type “A” defining a list property “bs” where the list-index is the order_idx of the association table, like in:

	<class name="A" table="a">
		<id name="id" column="id" />
		<list name="bs" table="a2b">
			<key column="a_id" />
			<list-index column="order_idx" base="1" />
			<many-to-many class="B"
				column="b_id" />

but I can’t get it working.
When I define the ORM->Collection Type->List, I get this error message:
null (A->B) The ordered relationship does not specify the ordered column.
Furthermore: If I do an “Instant reverse hibernate mapping files” (Tools->Code Engineering->Instant Reverse->Hibernate) and try to create the hibernate mapping files from the automatically generated new class diagram, I also get the error message:
null (A->B) The ordered relationship does not specify the ordered column.

How can I define such an association in the class diagram?

Thanks a lot for any tip,
best regards,

Hi Gap.

The ordered column should be define in the ER model which is mapped to your class (since order column is something in entity-relationship space rather than object space). You can define the ordered column on the mapped relationship by right click on it to open the specification dialog, then selected Ordered and pick the “Index column” (see attached pic). Once you have defined the ordered column in your entity you can then use the list as collection type. If there are any further inquiry, please do not hesitate to contact me.

Best regards,
Rain Wong

I’ve got email feedback from Visual Paradigm that resolves this issue.
The solution can be found here: http://stackoverflow.com/q/14920687/1614555

Thanks to Rain Wong from Visual Paradigm.

i try to export in doctrine but do not generate the appropriate (ordered) relationship.

in the doctrine model does not generate the “orderby” in hasMany / hasOne.

help me…