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?


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.)

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

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, privacy policy and cookie policy

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