ddd-example icon indicating copy to clipboard operation
ddd-example copied to clipboard

Is it the domain layer coupled with database stuff?

Open antunesleo opened this issue 5 years ago • 2 comments
trafficstars

Hello Ketan,

Found my self reading the blue book and looking for implementation examples, so I found your repository. I have a question for you. In the entity order (order_ddd_example/src/main/java/com/metamagic/ddd/entity/Order.java), Is it coupled with database stuff, right?

@PrimaryKey
@Persistent(column = "orderid", customValueStrategy="uuid")
private String orderId;

Shouldn't this stuff be in another place? I do ddd in the company I work for. We have to adapt a lot of the ddd stuff, but it worked for us. For study purposes, I'm trying to find a solution closer to the book. I found yours and it helps me a lot, specially in the repository part. but I didn't understand why you put this together.

antunesleo avatar Mar 10 '20 02:03 antunesleo

Everything in the domain layer should not use specific technology stuff: spring, orm..according to ddd

it's sure if your domain entity it's tempting to have the same structure in the db... otherwise, you need to create other object who will be the real mapping to the db...

marccollin avatar Dec 25 '20 19:12 marccollin

yeah and in the "api" package is spring stuff... thats a very technology driven approach and not really ddd

i'd like to have a "no-technology-model" that holds ONLY business logic, and not mixed with technology from third-parties. to achieve that, just split each package in its own project and see if it still compiles wihout all that third party deps.

damnms avatar Sep 03 '21 12:09 damnms