search

Home  >  Q&A  >  body text

Database - Regarding the configuration of JAVA spring transactions, is this correct?


Configure this in the spring configuration file and then


Is it ok to annotate this @Transactional in the method?
Which layer should I annotate at? Is it the control layer, service layer or dao layer? Or both are ok

? ? ? Why are you stepping on my question...

高洛峰高洛峰2747 days ago727

reply all(3)I'll reply

  • 为情所困

    为情所困2017-06-12 09:27:50

    Theoretically, it should be written in service, because the dao layer is only for data persistence. Sometimes the business involves inserting data and uploading it, or deleting data and deleting files at the same time. This kind of business is usually implemented in service. Therefore, it is recommended that you put the service layer and do not use transactions if you want to check data

    reply
    0
  • 代言

    代言2017-06-12 09:27:50

    Write on the specific implementation method of dao.

    reply
    0
  • PHP中文网

    PHP中文网2017-06-12 09:27:50

    Annotate on the business layer that the controller is a singleton by default. Under normal circumstances, just use the default thing

    reply
    0
  • Cancelreply