aspose file tools*
The moose likes Other Application Frameworks and the fly likes Building Effective Service layer using Spring+Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Building Effective Service layer using Spring+Hibernate" Watch "Building Effective Service layer using Spring+Hibernate" New topic
Author

Building Effective Service layer using Spring+Hibernate

Prav Chau
Ranch Hand

Joined: Jul 17, 2007
Posts: 58
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,


Prav Chau
SCJP, SCWCD, SCBCD, SCEA, http://pravinchaudhari.blogspot.com/
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Your that service may have references to other services required. Am I right?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Building Effective Service layer using Spring+Hibernate
 
Similar Threads
Which Security Framework should be used?
Understanding DI
how many layers in jpetstore application ?
What's the benefit of using those available Java frameworks
Implementing Persistance with Spring