Question

I am given a ERD to be converted to a class diagram for homework question.http://snag.gy/Misqv.jpg
I want to know what is the symbol inside "Receipt" .Is receipt an entity?
Also what is meant by the** circle near the association in entity Item mean?

Was it helpful?

Solution

Circle means that lower bound of the corresponding association end multiplicity is 0 (Product can be associated with 0 or more Items).

Receipt is a so called association class, a hybrid between association and class. It is used when a link between two objects (in this case Product an Inventory) has some attributes of its own (here probably receipt date, maybe quantity, price, etc). So, it is an entity, a special case of an entity.

Here is a corresponding UML diagram:

enter image description here

Receipt, translated into DB table would have two MANDATORY foreign keys (of Product and Inventory, in addition to its own fields).

OTHER TIPS

The Diamond shaped symbol inside Receipt in http://snag.gy/Misqv.jpg shows that the Receipt Entity is an Associative Entity. Associative Entities are also used (in addition to the reasons given in the answer by Aleks above) when you get Many to Many relationships between two existing entities. Many to Many relationships are problematic in software development, so to get around the problem we add virtual entities called Associative entities between them.

we have some small differences between UML Class diagrams and database ERD or EERD, first in ERD if you have N to M cardinality you will have to make a third table in between, but in classes you got an array of objects so basically you will need only 2 classes to represent the 3 tables(2 entities many to many relation)

second if you have a relation between ERD/EERD entities and the relation is also many to many you will need an association class but if the relation is 1-N or N-1 or 1-1 you can choose a better entity/class to use it as attribute/property inside instead of making a separate class

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top