title: Where should "@Transactional" be placed Service Layer or DAO
body: <p>Firstly it is possible that I am asking something that has been asked and answered before but I could not get a search result back. We define transactional annotations on service layer typical spring hibernate crud is usually</p>
  <blockquote>
  <p><em>Controller-&gt;Manager-&gt;Dao-&gt;Orm .</em></p>
  </blockquote>
  <p>I now have a situation where I need to choose between the domain model based on client site.
  Say client A is using my domain model all is good but then an other client site would give me a web service and not be using our domain model.</p>
  <p>Which layer should I be replacing . I believe it has to be DAO which will be getting me data from web service and sending it back.i.e two separately written DAO layers and plugged in based on scenario.</p>
  <p>I have now realized that we have been doing tight coupling (if there is such a thing or say not having loose coupling) when we put <code>@Transactional</code> in Service layer. So many brains can not be wrong or are they (I doubt it).</p>
  <p>So question is &quot;Where should &quot;<code>@Transactional</code>&quot; be placed Service Layer or DAO ?&quot; and is it service layer downwards I should be replacing.</p>
  <hr />
  <p>Eleven years on and still relevant . If I look back at the project somethings were obviously wrong with my understanding of Domain model back then . I was regarding ORM layer as domain model and we wanted to work with ORM and detached entities and no have any data mapping and not have any DTOs. That was the trend those days. These days Domain Model is not the ORM and having a proper Domain model and using ORM or Webservices are datasources take care of this issue. Like many pointed out yes Service is the right place for it and have proper domain model and not regard JPA (ORM) as domain model.</p>