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?

asked Sep 18, 2013 at 16:06
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.)

gnat
20.5k29 gold badges117 silver badges308 bronze badges
answered Jan 27, 2014 at 14:26
4
  • how does this answer the question asked? 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. Commented Jan 27, 2014 at 14:44
  • @gnat Should we really repeat the question in the answer? Commented Jan 27, 2014 at 14:58
  • in this case yes, since question title missed the key point addressed by your answer 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
answered Sep 18, 2013 at 17:18

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.