spring - Domain and service methods for banking transaction -


I am trying to learn the Spring Framework and many examples of using domain and service objects (domain-powered design) Am trying But I'm not really able to understand how to reach them. For example, I am trying to model a simple banking application that has clients, accounts and transactions. I have in the draft format given below:

  Domain objects: Customer ID Username Password Account: ID Customer ID Balance Transaction: ID Account ID Transaction Amount Transaction Type Type Service Objects: Account Service: (Account) Create an account for debit (account, amount, date, comment) credits (account, amount, date, comment) Transfer (acc, from ACC, amount, comment) Eyed (client income)? Customer Service: FindCustomerByName () FindAccount Customer Customer (Customer ID)?   
  1. Does customer service or account service get a method, customer to customer ID?

  2. Which domains / service objects should represent debit / credit transactions? Are debit (and) credit () methods defined in the account object or in the service object? I just want to continue the transaction rather than updating balance.

  3. Should all the business logic be in the service layer? I see most of the examples of spring, in this way it is.

    1. Since receiving the account here, This account must be in service.

    2. Since you are working on accounts, I am feeling OK in the account service in both ways. If you want to continue the transaction, you can handle this transaction and handle it for you, and whenever you need it, you will continue to call it from your account service. Both of your AccountService methods will allow you to transaction.

    3. When you have a business logic that is not in your DAO layer, you are useful if you do not force the transaction to continue. The latter should inquire from your database and return the appropriate domain object, while the services are used mostly for extra treatment, such as transactions or DTO mapping.

      To give you an idea, refer to the official spring sample app.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -