• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Building Effective Service layer using Spring+Hibernate  RSS feed

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am building a application framework with Spring and Hibernate. I want to write a Service Layer ( Business Logic Layer ) which will effectively and efficiently call the Hibernate DAO bean methods with help of Spring Framework.

Consider a case where one application functionality requires to interact with 3 - 4 tables. Each table will be Entity having a Hibernate DAO class.How will my service layer call 3 - 4 DAO classes? Is there a better design which will suffice this scenario. Basically I want to write a Service Layer which will be capable getting data talking to all DAO classes efficiently.

Can someone paste me code snippet or example.

Thanks,

 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your that service may have references to other services required. Am I right?
 
ranger
Posts: 17344
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your service use case requires multiple DAOs to succeed, then just inject those DAOs into your Service class. That is exactly the design that should be followed. There are indeed dependencies, and now they are still loosely coupled with Spring injection.

Mark
 
That's a very big dog. I think I want to go home now and hug this tiny ad:
java tutor first lesson for free
https://coderanch.com/t/702613/java-tutor-lesson-free
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!