도메인에서 분리되어야 하는 이유

  • The domain model implementation is usually a central,
    organizing component; it’s reused heavily whenever you implement new
    application functionality. For this reason, you should be prepared to
    go to some lengths to ensure that concerns other than business aspects
    don’t leak into the domain model implementation.

관심사 누수leakage of concern

  • You shouldn’t put code that addresses these crosscutting
    concerns in the classes that implement the domain model. When these
    concerns start to appear in the domain model classes, this is an
    example of leakage of concerns.
  • EJB 컨테이너가 interseption을 사용해서 몇몇 leakage of concern을 해결했지만,
    EJB 2.1에서 도메인에 많은 규칙과 제약을 부과하는 바람에 관심사 누수가 생겼다. 이 경우에는 컨테이너 구현 관심사가 누수
    됐다. EJB 3.0은 이것을 반영해서 다시 비침략적nonintrusive이고 훨씬 전통적인 JavaBean 프로그래밍 모델에
    가까워졌다.

하이버네이트의 관심사

  • Hibernate is a solution for just one of these concerns: persistence.
  • Hibernate persistent classes and the EJB 3.0 entity
    programming model offer transparent persistence. Hibernate and Java
    Persistence also provide automatic persistence.

참조 : Java Persistence With Hibernate