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

Portlet Always Writes to the Local Database, even if it is Configured to Write to an External Database

    Details

      Description

      Description
      A portlet's ability to write/read from an external database is broken as of LPS-68980. This happens because LPS-68980 unified all the different transactions, without accounting for the fact that the user may have a custom portlet that doesn't touch the Liferay database at all.

      Please note that the table ssb_foo is generated in the local database. Service builder should not do this since the external database is being used. This might be a separate bug that should be investigated, as well.

      Steps to reproduce

      1. Create two databases - a local database and an external database.
      2. From the attached sample-blade-servicebuilder-portal-properties.zip, add the three modules to osgi/modules in your bundle.
      3. Add the following properties to my portal-ext.properties (modify these for your environment):
        jdbc.test.driverClassName=com.mysql.jdbc.Driver
        jdbc.test.url=jdbc:mysql://localhost:3306/[external_DB_name]?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
        jdbc.test.username=root
        jdbc.test.password=test
        
        jdbc.default.driverClassName=com.mysql.jdbc.Driver
        jdbc.default.url=jdbc:mysql://localhost:3306/[local_DB_name]?characterEncoding=UTF-8&dontTrackOpenResources=true&holdResultsOpenOverStatementClose=true&useFastDateParsing=false&useUnicode=true
        jdbc.default.username=root
        jdbc.default.password=test
      4. Create the ssb_foo table on the external database with this script:
        create table SSB_Foo (
            uuid_ VARCHAR(75) null,
            fooId BIGINT not null primary key,
            groupId BIGINT,
            companyId BIGINT,
            userId BIGINT,
            userName VARCHAR(75) null,
            createDate DATE null,
            modifiedDate DATE null,
            field1 VARCHAR(75) null,
            field2 BOOLEAN,
            field3 INTEGER,
            field4 DATE null,
            field5 VARCHAR(75) null
        );
      5. Start the portal.
      6. Add the sample portlet from the Sample category. Note that the name of this particular portlet is blank under the category Sample.
      7. Add an object in the portlet

      Expected Result: As is seen in a version of the portal prior to LPS-68980, the object is written to the external database and is displayed in the portlet.
      Actual Result: The object is written to the local database's ssb_foo table.

      Reproduced in
      master? Yes, issue reproduced in master (cd83aa91d9654b8b08eef75dbc6eb54d1b97e705)
      ee-7.0.x? Yes, issue reproduced in ee-7.0.x (727286e5e436c0f76f5efd291123cea2379d47c4)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sylvia.luan Sylvia Luan
                Reporter:
                michael.bowerman Michael Bowerman (Inactive)
                Participants of an Issue:
                Recent user:
                Csaba Turcsan
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 40 weeks, 5 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP10
                  7.0.0 DXP SP2
                  7.0.3 CE GA4
                  7.0.0 DXP FP29
                  7.0.4 CE GA5
                  7.1.X
                  Master