I have Java Spring web application and UML. I have class PersonalClient
(@Entity) and I have interface-repository that interacts with data base using that entity - PersonalClientRepository
(CRUD). For now, on my UML it looks like this (green arrow):
But I think, that this is wrong. Is there correct way to show this relationships?
CodePudding user response:
You show an «Interface» PersonalClientRepository
that extends «Interface» CrudRepository
. Extension in Java is specialization in UML. It should be represented with an arrow head that is a big white triangle. (The small arrow on your diagram is confusing since it means in UML a navigable association, which is something completely different).
I understand that your «Entity» PersonalClient
is the kind of object that PersonalClientRepository
would find or store and that it is not itself an implementation of that interface:
You should then replace your green arrow and draw a dependency from PersonalClientRepository
to PersonalClient
instead: it's a dotted line with an open head arrow. This means that the repository needs to know about the client (because it uses or creates some):
A class diagram is not a data flow diagram. You do not use bidirectional arrows to show input/output. For this behavioral kind of logic, you'd use an UML activity diagram.
The unidirectional dependency is sufficient to express that the repository deals with clients, regardless if it's input or output.
Conversely, PersonalClient
does not structurally need the repository. You could perfectly well use this client without a repository.