![]() | SUMit Roster Software > Nut's Weekly > January 2002 > Mapping | Nederlands · Search... |
Mapping |
Monday, 28 January 2002 |
![]() | |
How does one map a relationship (= association) from
an ERD
to variables (= properties, fields) in a Java class?
The mapping is somewhat similar to the optimisation steps in physical database design. There are some differences, though.
![]() to-oneThis can be a one-to-one or a many-to-one relationship.
|
|||
Situation | Mapping | Java code | |
---|---|---|---|
There is not a single function that uses the direction 'to-one'.
Example: Going from Reader you'll never have to access the related area. |
No mapping. |
|
|
All functions have the 'one' available.
This often occurs with an identifying 'to-one' relationship from the
SNF.
Example: A subscription is only accessed through reader. Every reader knows its subscriptions. The backward implementation, from subscription to reader, is redundant. |
No mapping either |
|
|
The 'to-one' relationship is used.
Example: from Subscription to Newspaper. |
Create a variable that points to the 'one'. |
|
|
to-many | |||
Situation | Mapping | Java code | |
There is no function that uses the 'to-many' direction.
Example: Coming from Newspaper you'll never have to access all readers. |
No mapping. |
|
|
There is an access path using the 'to-many' relationship.
Sometimes that relationship is used to find one specific instance.
Examples:
|
Implement the to- many relationship as a Hashmap. | ||
There is an access path using the 'to-many' relationship.
The sequence is important.
Example: For a delivery boy the sequence of readers in his route is important. |
Implement the to-many relationship as a Vector. | ||
IM Astrid Lindgren, 1907 - 2002 | |||
December 2001
· Indicator
· Buttons
· Euro
· Mapping
· February 2002
Home · Search... | |||