-
Jun 3rd, 2010, 12:41 PM
#1
Layerd Architecture
Hi Guys,
I am new to Spring and just started a project. In there i have decided to use 3 layes web, Service and DAO. So method callings should be from web to Service
and then service to DAO. In here i need to use business logic from another service. So can we call one service from another service. Or do we have to write that service class as another utility class. what is the best practise for above scenario. your help will be appriciated
Thanks
Keth
-
Jun 4th, 2010, 07:58 AM
#2
Per se, there is nothing wrong with calling one service from another. Yet there are a few things to look out for:
- Invoking a service method often starts (and ends) a transaction. Make sure you don't start a new transaction, when you invoke a service method from within a service method. This could lead to inconsistencies
- A utility class might be easier for maintenance in the long run. There is simply less code to look at in case of changes.
- Needing the same functionality in two places is a strong hint to put that functionality into the domain model if possible or into an aspect or a proxy.
HTH
-
Jul 12th, 2010, 08:41 AM
#3
Hi,
great post, it really helped me alot…gives me alot of information… thanks…. nice job…
_______________________
Credit Repair | Bad Credit Repair Report
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules