salesforce-jdbc icon indicating copy to clipboard operation
salesforce-jdbc copied to clipboard

Result set from a relationship query is dropping all but one column from the related object

Open ctaclas-8x8 opened this issue 4 years ago • 0 comments

Steps to reproduce:

  1. Form a query that retrieves a multiple columns from a related object
  2. Perform a query using ForcePreparedStatement executeQuery method Observed Result: Only one of the columns from the related object is included in result set. There is a mismatch between metadata colCount and the actual number of columnNames and values in their respective arrayLists in the returned ResultSet Expected Result: The ResultSet should include all expected columnNames and Values, and the number of columnNames and values from ResultSet should match the metadata colCount.

I have this query that returns results as expected when executed from Salesforce Workbench:

SELECT Id,Credit_Card_Address_1__c,Credit_Card_Address_2__c,Credit_Card_Expiration_Month__c,Credit_Card_Expiration_Year__c,Credit_Card_Holder_Name__c,Credit_Card_Type__c,Payment_Type__c,CreditCardLastName__c,CreditCardFirstName__c,Billing_Address__r.Apttus_Config2__Street__c,Billing_Address__r.Apttus_Config2__City__c,Billing_Address__r.Apttus_Config2__Country__c,Billing_Address__r.Apttus_Config2__PostalCode__c,Billing_Address__r.Apttus_Config2__State__c FROM Payment_Method__c WHERE Id = 'a0m53000000HRRSAA4'

The above query is getting a couple of columns from one table (Payment_Method__c), and is including a 5 columns from a related table (Billing_Address__r). When running this query through salesforce-jdbc, the result from ForcePreparedStatement executeQuery method is only including the first column from Billing_Address__r and seems to be dropping the remaining 4. bizappsqe_autoeght_–_DbUtils_java

Looking at the raw data from PartnerService query method, it looks like SFDC is returning all the data from the related record, there is an SObject that includes all 5 of the expected fields from Billing_Address__r: bizappsqe_autoeght_–PartnerService_java__Maven__com_ascendix_salesforce_salesforce-jdbc_1_1-SNAPSHOT

It appears that the child data from Billing_Address__r is getting dropped in the PartnerService toForceResultField method: bizappsqe_autoeght_–PartnerService_java__Maven__com_ascendix_salesforce_salesforce-jdbc_1_1-SNAPSHOT

ctaclas-8x8 avatar Aug 12 '21 17:08 ctaclas-8x8