Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-9671 Add missing foreign key constraints in entity definition
  3. OFBIZ-9678

Missing foreign key constraint for fields userLoginId & userPrefGroupTypeId in UserPreference entity

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Implemented
    • Affects Version/s: None
    • Fix Version/s: Upcoming Release
    • Component/s: ALL COMPONENTS
    • Labels:
      None

      Description

      UserPreference.userLoginId is related to UserLogin.userLoginId.
      UserPreference.userPrefGroupTypeId is related to UserPrefGroupType.userPrefGroupTypeId.

      1. OFBIZ-9678.patch
        1.0 kB
        Aditya Sharma
      2. OFBIZ-9678.patch
        0.9 kB
        Aditya Sharma

        Activity

        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Yes thanks Deepak, forgot it

        Show
        jacques.le.roux Jacques Le Roux added a comment - Yes thanks Deepak, forgot it
        Hide
        deepak.dixit Deepak Dixit added a comment -

        Thanks Jacques,

        Now I think we can close this.

        Show
        deepak.dixit Deepak Dixit added a comment - Thanks Jacques, Now I think we can close this.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Thanks Aditya,

        Finally completed: At revision: 1809383

        Show
        jacques.le.roux Jacques Le Roux added a comment - Thanks Aditya, Finally completed: At revision: 1809383
        Hide
        aditya.sharma Aditya Sharma added a comment -

        Yes, Sure Jacques I will

        Show
        aditya.sharma Aditya Sharma added a comment - Yes, Sure Jacques I will
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Checking with one-no-fk...

        Show
        jacques.le.roux Jacques Le Roux added a comment - Checking with one-no-fk...
        Hide
        aditya.sharma Aditya Sharma added a comment -

        UserLogin can have 'NA' too. Missed on that. Updated patch with one-nofk relation & updated relation names.

        Show
        aditya.sharma Aditya Sharma added a comment - UserLogin can have ' NA ' too. Missed on that. Updated patch with one-nofk relation & updated relation names.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Yes Deepak, I wondered about that, but thought Aditya has tested.

        Aditya, please be sure to test when doing data model change

        Show
        jacques.le.roux Jacques Le Roux added a comment - Yes Deepak, I wondered about that, but thought Aditya has tested. Aditya, please be sure to test when doing data model change
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        OK, I can confirm that all tests pass when I revert r1809375, I reopen

        Show
        jacques.le.roux Jacques Le Roux added a comment - OK, I can confirm that all tests pass when I revert r1809375, I reopen
        Hide
        deepak.dixit Deepak Dixit added a comment -

        I think relation type should be one-no-fk.

        Show
        deepak.dixit Deepak Dixit added a comment - I think relation type should be one-no-fk.
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Hi Aditya I think we have issues with recent data model changes, see https://ci.apache.org/builders/ofbiz-trunk-framework/builds/471
        and while loading

        2017-09-23 11:05:42,654 |main                 |EntitySaxReader               |I| Transaction Timeout set to 2 hours (7200 seconds)
        2017-09-23 11:05:42,865 |main                 |GenericDelegator              |E| Failure in create operation for entity [UserPreference]: org.apache.ofbiz.entity.GenericEntityException: Error while inserting:
         [GenericEntity:UserPreference][createdStamp,2017-09-23 11:05:42.86(java.sql.Timestamp)][createdTxStamp,2017-09-23 11:05:42.654(java.sql.Timestamp)][lastUpdatedStamp,2017-09-23 11:05:42.86(java.sql.Timestamp)
        ][lastUpdatedTxStamp,2017-09-23 11:05:42.654(java.sql.Timestamp)][userLoginId,_NA_(java.lang.String)][userPrefGroupTypeId,GLOBAL_PREFERENCES(java.lang.String)][userPrefTypeId,VISUAL_THEME(java.lang.String)][u
        serPrefValue,DEFAULT(java.lang.String)] (SQL Exception while executing the following:INSERT INTO OFBIZ.USER_PREFERENCE (USER_LOGIN_ID, USER_PREF_TYPE_ID, USER_PREF_GROUP_TYPE_ID, USER_PREF_VALUE, USER_PREF_DA
        TA_TYPE, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table 'USER_PREFERENCE' caused a violation of foreign key constraint 'UP_USER
        _LOGIN' for key (_NA_).  The statement has been rolled back.)). Rolling back transaction.
        2017-09-23 11:05:42,865 |main                 |TransactionUtil               |W| Calling transaction setRollbackOnly; this stack trace shows where this is happening:
        java.lang.Exception: Failure in create operation for entity [UserPreference]: org.apache.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:UserPreference][createdStamp,2017-09-23 11:0
        5:42.86(java.sql.Timestamp)][createdTxStamp,2017-09-23 11:05:42.654(java.sql.Timestamp)][lastUpdatedStamp,2017-09-23 11:05:42.86(java.sql.Timestamp)][lastUpdatedTxStamp,2017-09-23 11:05:42.654(java.sql.Timest
        amp)][userLoginId,_NA_(java.lang.String)][userPrefGroupTypeId,GLOBAL_PREFERENCES(java.lang.String)][userPrefTypeId,VISUAL_THEME(java.lang.String)][userPrefValue,DEFAULT(java.lang.String)] (SQL Exception while
         executing the following:INSERT INTO OFBIZ.USER_PREFERENCE (USER_LOGIN_ID, USER_PREF_TYPE_ID, USER_PREF_GROUP_TYPE_ID, USER_PREF_VALUE, USER_PREF_DATA_TYPE, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_
        STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table 'USER_PREFERENCE' caused a violation of foreign key constraint 'UP_USER_LOGIN' for key (_NA_).  The statement has been rolled back.
        )). Rolling back transaction.
        

        I'm not yet sure, but not only here but maybe also with https://ci.apache.org/builders/ofbiz-trunk-framework/builds/472 checking...

        Show
        jacques.le.roux Jacques Le Roux added a comment - Hi Aditya I think we have issues with recent data model changes, see https://ci.apache.org/builders/ofbiz-trunk-framework/builds/471 and while loading 2017-09-23 11:05:42,654 |main |EntitySaxReader |I| Transaction Timeout set to 2 hours (7200 seconds) 2017-09-23 11:05:42,865 |main |GenericDelegator |E| Failure in create operation for entity [UserPreference]: org.apache.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:UserPreference][createdStamp,2017-09-23 11:05:42.86(java.sql.Timestamp)][createdTxStamp,2017-09-23 11:05:42.654(java.sql.Timestamp)][lastUpdatedStamp,2017-09-23 11:05:42.86(java.sql.Timestamp) ][lastUpdatedTxStamp,2017-09-23 11:05:42.654(java.sql.Timestamp)][userLoginId,_NA_(java.lang. String )][userPrefGroupTypeId,GLOBAL_PREFERENCES(java.lang. String )][userPrefTypeId,VISUAL_THEME(java.lang. String )][u serPrefValue,DEFAULT(java.lang. String )] (SQL Exception while executing the following:INSERT INTO OFBIZ.USER_PREFERENCE (USER_LOGIN_ID, USER_PREF_TYPE_ID, USER_PREF_GROUP_TYPE_ID, USER_PREF_VALUE, USER_PREF_DA TA_TYPE, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table 'USER_PREFERENCE' caused a violation of foreign key constraint 'UP_USER _LOGIN' for key (_NA_). The statement has been rolled back.)). Rolling back transaction. 2017-09-23 11:05:42,865 |main |TransactionUtil |W| Calling transaction setRollbackOnly; this stack trace shows where this is happening: java.lang.Exception: Failure in create operation for entity [UserPreference]: org.apache.ofbiz.entity.GenericEntityException: Error while inserting: [GenericEntity:UserPreference][createdStamp,2017-09-23 11:0 5:42.86(java.sql.Timestamp)][createdTxStamp,2017-09-23 11:05:42.654(java.sql.Timestamp)][lastUpdatedStamp,2017-09-23 11:05:42.86(java.sql.Timestamp)][lastUpdatedTxStamp,2017-09-23 11:05:42.654(java.sql.Timest amp)][userLoginId,_NA_(java.lang. String )][userPrefGroupTypeId,GLOBAL_PREFERENCES(java.lang. String )][userPrefTypeId,VISUAL_THEME(java.lang. String )][userPrefValue,DEFAULT(java.lang. String )] (SQL Exception while executing the following:INSERT INTO OFBIZ.USER_PREFERENCE (USER_LOGIN_ID, USER_PREF_TYPE_ID, USER_PREF_GROUP_TYPE_ID, USER_PREF_VALUE, USER_PREF_DATA_TYPE, LAST_UPDATED_STAMP, LAST_UPDATED_TX_STAMP, CREATED_ STAMP, CREATED_TX_STAMP) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) (INSERT on table 'USER_PREFERENCE' caused a violation of foreign key constraint 'UP_USER_LOGIN' for key (_NA_). The statement has been rolled back. )). Rolling back transaction. I'm not yet sure, but not only here but maybe also with https://ci.apache.org/builders/ofbiz-trunk-framework/builds/472 checking...
        Hide
        aditya.sharma Aditya Sharma added a comment -

        Thanks Jacques

        Show
        aditya.sharma Aditya Sharma added a comment - Thanks Jacques
        Hide
        jacques.le.roux Jacques Le Roux added a comment -

        Thanks Aditya

        Completed: At revision: 1809375

        Show
        jacques.le.roux Jacques Le Roux added a comment - Thanks Aditya Completed: At revision: 1809375
        Hide
        aditya.sharma Aditya Sharma added a comment -

        Added relation for UserPreference.userLoginId to UserLogin.userLoginId & UserPreference.userPrefGroupTypeId to UserPrefGroupType.userPrefGroupTypeId.

        Show
        aditya.sharma Aditya Sharma added a comment - Added relation for UserPreference.userLoginId to UserLogin.userLoginId & UserPreference.userPrefGroupTypeId to UserPrefGroupType.userPrefGroupTypeId.

          People

          • Assignee:
            jacques.le.roux Jacques Le Roux
            Reporter:
            aditya.sharma Aditya Sharma
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development