views:

33

answers:

2

I have seen the ideas of domain models in UML, but I never got the chance to work with them in actual code. Now I see them in databases, particularly SQL coding, from this article

And there was a quote that mentions domain model classes:

I can design Domain Model classes containing plain SQL as easily as I can design classes that operate on the database via an ORM layer. Keep in mind that ActiveRecord is not a Domain Model.

How do I create domain classes then? Does it differ when I'm in the "database context" when I'm in the "modeling context" or even the "programming context"?

A: 

A domain model has no notion of a database. It should be the logical representation of a problem domain. You've likely worked with domain models in every one of your projects to some degree.

To tie a domain model to a database, the Repository pattern makes for an excellent mediator.

A: 

Very nice article, thanks for the link. Did you have a look at one of the Omondo UML examples which show how to use object approach and visualize your domain in an UML diagram ?

Reverse engineering of a database: http://www.forum-omondo.com/documentation_eclipseuml_2008/Eclipse_Database/Reverse_Existing_Database/index.html

Oracle example: http://www.forum-omondo.com/documentation_eclipseuml_2008/Eclipse_Database/Activate_JPA_Perspective/oracle_integration.html

Create JPA classes: http://www.forum-omondo.com/documentation_eclipseuml_2008/Eclipse_Database/Create_New_JPA_Classes/index.html

It seems to me that ORM modeling with UML is not a well established technology because only Omondo EclipseUML provides these ORM features ? The other UML tools can not generate java annotation or reverse them. They generate code from a model but not ORM or JPA annotations because they directly generate a kind of database which is not for me an object approach. This is a non sense if UML tools generate database because database is not an object ? This is why the Omondo approach to generate ORM annotations and let the mapper do its job is what should be done. In my company we have created our model then let the database admin to add the UML stereotypes which are synchronized with the java annotation. finally we have passed all the project to the developer team. The code was very clean and easy to integrate later. It was a continuous integration from a model to the database using Eclipse and maven. It worked very well.

I have used UML and ORM in my last few projects. It is really very powerful !! I think that we will see more project in the future using ORM and UML modeling.