Hello, I'm upgrading old v1 code to 2.6 and running into the following issue.
I have a type called "Document" and a subtype called "PurchaseOrder". The following subroutine is intended to set the "IDDocumentStatus" field for all PurchaseOrders matching the IDs passed in.
Public Sub ChangePOStatus(ByVal poIDsToChange As ArrayList, ByVal newDocumentStatusID As Guid) Implements IPurchaseOrderService.ChangePOStatus
Dim adapter As DataAccessAdapter = GetAdapter()
Dim poWithNewStatus As New PurchaseOrderEntity
If newDocumentStatusID.Equals(Guid.Empty) Then
poWithNewStatus.SetNewFieldValue(PurchaseOrderFieldIndex.IDDocumentStatus, Nothing)
Else
poWithNewStatus.IDDocumentStatus = newDocumentStatusID
End If
Dim predExp As New PredicateExpression(New FieldCompareRangePredicate(PurchaseOrderFields.IDPurchaseOrder, Nothing, poIDsToChange.ToArray(GetType(Guid))))
adapter.UpdateEntitiesDirectly(poWithNewStatus, New RelationPredicateBucket(predExp))
End Sub
Here's the resulting Sql:
UPDATE [dbo].[Document]
SET [IDDocumentType]=@IDDocumentType,[IDDocumentStatus]=@IDDocumentStatus WHERE ( ( ( [dbo].[PurchaseOrder].[IDPurchaseOrder] IN (@IDPurchaseOrder1))))
The problem is that the Sql fails because dbo.PurchaseOrder isn't in the SELECT list. Since this is an inheritance hierarchy the Update statement looks like it's generated incorrectly, specifically there should be a JOIN to PurchaseOrder from Document.
This used to work in v1, but it seems something changed. Can anyone verify this for me?
Jeff...