2

Suppose I want to draw a class diagram of a DAO and an Entity. The DAO is used to load instances of the Entity from the database. How can I represent this relationship on my class diagram? Is this considered one? I think it should be displayed on the diagram somehow:

enter image description here

TL;DR: should I draw something between them or not?

1

2 Answers 2

1

DAO loads data from DB and CREATES instances of Entity:

enter image description here

There is a special stereotype for such dependency. Class INSTANTIATES Class2, if it creates its instances. Exists in UML standard. ( I checked 2.4.1 - contemporary and 2.5 - the next one.)

4
  • how does this answer the question asked?
    – gnat
    Commented Jan 27, 2014 at 14:43
  • DAO loads data from DB and CREATES instances of Entity. It is EXACTLY the answer for the question.
    – Gangnus
    Commented Jan 27, 2014 at 14:44
  • @gnat Should we really repeat the question in the answer?
    – Gangnus
    Commented Jan 27, 2014 at 14:58
  • in this case yes, since question title missed the key point addressed by your answer
    – gnat
    Commented Jan 27, 2014 at 15:14
3

The closest I can think of is a usage relationship. Possible stereotypes: "use", "call", "create", "instantiate", "send".

SomeDAO ---<<use>>---> SomeEntity

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.