Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-85849

dynamicQuery methods should be annotated with @Transactional(readOnly=true)

    Details

      Description

      In case of a using read/write database splitting, dynamic queries go to the write database. This is wrong, because dynamic queries are similar to fetches in the sense that there shouldn't be an update within the call.

      Read/write database splitting is implemented by DynamicDataSourceAdvice.java class what is a Spring Advice. The logic is that each method call hits the write database unless the method has a @Transactional(readOnly=true) annotation. This annotation instructs the advice to switch to the read datasource.

      To eliminate the issue, *LocalService.dynamicQuery() methods should be annotated with @Transactional(readOnly=true).

       

        Attachments

          Activity

            People

            • Assignee:
              beck.liu Beck Liu
              Reporter:
              istvan.sajtos Istvan Sajtos
              Participants of an Issue:
              Recent user:
              Csaba Turcsan
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                43 weeks, 5 days ago

                Packages

                Version Package
                7.0.0 DXP FP60
                7.0.0 DXP SP9
                7.0.X
                7.1.10 DXP FP3
                7.1.1 CE GA2
                7.1.10.1 SP1
                7.1.X
                Master