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

I am delving into the science of UML. The tool I am using is ArgoUML. I feel very confident portraying OO designs through this tool. But what still vexes me is the incorporation of the database. What does one do in UML to show table structure? Stored procedures? So on and so forth.

share|improve this question
I'm guessing you're not just looking for ERD ( )? – FrustratedWithFormsDesigner Jul 6 '11 at 21:23
FWFD, I am not just looking for ERD. I want to incorporate my database architecture within UML. Great link, though! – user29981 Jul 6 '11 at 21:30
There's a science of UML? – kevin cline Jul 7 '11 at 5:55
That's what it's starting to seem like! – user29981 Jul 7 '11 at 6:16
up vote 1 down vote accepted

Start here:

What does one do in UML to show table structure?

Classes are tables. They just lack methods. Perfectly simple UML. Indeed, the UML for entities and relationships was carefully considered.

Just set your class definitions so they don't show the compartment with methods. That's all.

You can use a stereotype to identify those classes that map to tables.

Stored procedures?

Stored procedures are an abomination. You can think of them as free-standing objects (i.e., special-purpose classes with only one instance and only one method.)

You can think of the "schema" as class which contains stored procedures as methods. That's not too bad.

My preference is to simply disallow them entirely and save yourself the agony of designing and documenting them. Everything you think you might want to do with a stored procedure can be done with a "Model-layer" class (and methods) that maps to a "Persistence-layer" RDBMS tables.

See this:

It seems quite clear.

share|improve this answer
Are you talking about not using Stored Procedures in my design? Or just my UML diagram? If the former, then I would have to disagree. – user29981 Jul 7 '11 at 1:15
@Surfer513: The former. I realize that many people have an unsupportable love for SP's. Feel free to use them, even though they add no measurable value. Almost any UML notation is fine for them, but they are simply a development and maintenance nightmare waiting to happen. Please don't justify their use by responding; you are already free to use them in the same way you are free to use other bad programming practices. Bad practices (like stored procedures) don't require elaborate justification. Just use them as you see fit. – S.Lott Jul 7 '11 at 1:17

I think that there are two opposite visions of UML and databases.

On one side you have traditional and old methodology using Model Driven Development and books such as Scoot Ambler.

On the other hand you have new initiative where UML is reversing Java annotations and adding this information in the code. I mean that UML is synchronized with the java code persistence annotations used by the EJB3 specifications (e.g. hibernate annotations). These annotations are created by using a Database profile composed by database stereotypes. This database modeling at the same stage as the object UML model modeling is only possible because of the use of JDK 5..7 annotations with ORM mappers. It means that you have to know not only UML but also the way the mapper will be working. Pretty hard but really powerful and time saving approach.

share|improve this answer

Your Answer


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