• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Working detached in the service layer

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,

i will be happy to your opinions regarding - working detached in the service layer/ business layer.

For my opinion work attached in the servie layeris not a good practice since in this way we bypass the dao layer, which break the encapsulation and resposibility rule of each layer.

I dont love the attach idea, for my option save to the DB need to have single point of responsibility.

Additional point:
Since we begin the transaction in the service layer the objects that will returned from the DAO are in attached mode, so if we want to work detach we have several options:
1. call to evict or clear - not good , because we lose the first level cache advantage.
2. copy them to new objects - not so simple, because they have proxy ...
3. use in solutions like giled.
4. deepl clone by serialize

Do you have more solutions?

a link to similar topic:
http://www.theserverside.com/news/thread.tss?thread_id=40581
Thank you

reply
    Bookmark Topic Watch Topic
  • New Topic