Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
The GOF patterns are often illustrated by UML examples, for your case look here,, – Doc Brown Sep 18 '13 at 18:13
up vote 1 down vote accepted

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

share|improve this answer
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
@gnat Yes, I see. Thank you. – Gangnus Jan 27 '14 at 15:28

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

SomeDAO ---<<use>>---> SomeEntity
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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