Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

are hibernate applications domain driven?

If I'm developing a hiberante application, am I also developing a DD model?

My application does have a service layer ( which is in lines with the Observer pattern). Will there also be a Domain Layer wherein all the hibernate entities exist?

I'm looking my application somehting like this:

alt text

Do I need to know Domain Driven Design to write Hibernate Entities?

Can the application be hybrid - OOD in the service layer and DDD in the persistence layer?

I'm confused. Please clarify.

like image 406
jai Avatar asked Aug 29 '10 14:08

jai


People also ask

What is domain model in hibernate?

Domain model "is-an" entity @Entity @Table(name = "agent") class Agent { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Column(name = "agent_number", unique = true, nullable = false) private String agentNumber; @Column(name = "agent_name", nullable = false) private String agentName; // ...

What is Domain Driven Development in Java?

Domain-Driven Design (DDD) is a set of principles and tools that helps us design effective software architectures to deliver higher business value.


2 Answers

If I'm developing an Hibernate application, am I also developing a DD model?

When using Hibernate, you'll probably create a domain model of entities and do some domain modeling but you aren't necessarily following Domain-Driven Design principles, there is no direct implication. And actually, I'm tempted to say that it's most often the contrary, most Hibernate applications end up having an anemic domain model.

Do I need to know Domain Driven Design to write Hibernate Entities?

No. there is no particular knowledge to have to write Entities. However, if you want to follow DDD, you obviously need to have some knowledge of DDD. And if you want to go this direction, using Hibernate (as your factory for entities) has some implications on the implementation. Domain-Driven Design with Spring and Hibernate is a very nice blog post on the topic and describes an AOP based approach.

Resources

  • The official Domain-Driven Design Community website
  • The Domain-Driven Design yahoo group
  • Domain-Driven Design Quickly (great summary book of Eric Evans's reference book).

  • Chris Richardson's aop-ood sample application

See also

  • Still confused about repositories
like image 120
Pascal Thivent Avatar answered Nov 03 '22 14:11

Pascal Thivent


actually DDD is an approach and is not tied to the tools that you are using.

you can use Hibernate or any other OR mappers to do DDD or any other aspects that you thins is suitable for your case.

read more about DDD: http://en.wikipedia.org/wiki/Domain-driven_design

like image 23
mhshams Avatar answered Nov 03 '22 12:11

mhshams