It's not a secret anymore!
The moose likes Object Relational Mapping and the fly likes Domain Driven Design and Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Domain Driven Design and Hibernate" Watch "Domain Driven Design and Hibernate" New topic

Domain Driven Design and Hibernate

Kris Woo

Joined: Sep 17, 2012
Posts: 2


Not too sure which forum section this would belong to (here, OO or the Java EE), but just needed some thoughts on the follow issue.

I've worked mainly on JEE applications which uses domain driven design, so all our domain objects use encapsulation, uses factory methods for creating them and contains business logic.

Starting a new project with the intention to use Hibernate, however it seems that using hibernate it will break the use of encapsulation and make a full domain driven design very difficult to manage.

I've came across the following blog entry which someone has attempted to implement this with hibernate. DDD and Hibernate.

Has anyone else came across this issue? I'd like to hear what others think, if you have any pages, text, books that would help please post them and I'll take a look.

Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

Have a look at Spring Roo. One of the configuration options (the only one they used to support ) is the active record pattern. Creating a project with Spring Roo and having a look at the code it generates may help you move along in the right direction, although I would not classify it as DDD in the strictest sense it does move in that direction.

Another code generation project I have seen but not tried, specifically states it supports domain driven design can be found here:

I am not necessarily promoting extended use of either of these tools but I am saying that playing with them a little bit and examining the output might give you some insight on how to achieve your goal.

[How To Ask Questions][Read before you PM me]
I agree. Here's the link:
subject: Domain Driven Design and Hibernate
It's not a secret anymore!