Reputation: 571
I am new to learning UML andI have an ERD diagram to be converted to a class diagram as an exercise.
Two entities in it are InvoiceItem and InventoryItem.
InvoiceItem has attributes quantity added while attributes of InventoryItem are itemNo,ItemDescription,QuantityInStock.
When I am converting to class diagram is their a dependency between these two entities.In the ERD the two entities are linked as
What is denoted by the circle near the entity InvoiceItem?
Also InvoiceItem is linked with another entity Invoice which has the attributes InvoiceNo,InvoiceDate,isPaid.
Can I consider the relationship between Invoice and InvoiceItem as a composition. Because invoice is composed of invoiceItems and if invoice is deleted InvoiceItems too gets deleted.
Upvotes: 0
Views: 313
Reputation: 5854
The circle in ERD denotes the lower multiplicity bound of 0 (see diagram bellow). This tells that not each InventoryItem has an InvoiceItem.
Yes, the relationship between Invoice and InvoiceItem is composition for the reason you stated. This is a clear, perfect example of a composition.
And the target diagram:
Upvotes: 1