Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-3158

Add more control over flush mode

    XMLWordPrintable

    Details

    • Complexity:
      Medium

      Description

      So far whenever we needed to execute a service method in the manual flush mode our approach was to go down to the DAO layer, which resulted in such strange constructions as in getDefaultConceptMapType, where we put in the DAO layer code that really belonged to the service layer. There are three possible ways to improve that.

      1. CustomSessionFlushTask.

      2. Context.getFlushMode() and Context.setFlushMode(flushMode). We'd need our own FlushMode enum so that we don't introduce a dependency on Hibernate in the service layer.

      3. @ManualFlush annotation to annotate service methods that we want to explicitly execute in the manual flush mode. It's a more elegant variation of 2., but slightly less useful since it requires to create a dedicated method. For instance we have the getConcept method and if we want it to be executed in one place only in the manual flush mode we need to create a second method getConceptInManualFlush for the purpose of annotating it with @ManualFlush.

      See also this thread.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                grace Grace Potma
                Reporter:
                raff Rafal Korytkowski
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: