FieldCompareSetPredicate not working (with Self Servicing Oracle templates)

Posts   
 
    
jbliss1234
User
Posts: 42
Joined: 04-May-2007
# Posted on: 04-May-2007 05:08:26   

I am trying to write a property to mimic this SQL:

select * from chds_personnel where personnel_id in ( select delegatee from delegation where personnel_id = 96242 )

The code I wrote is : Dim retVal As ChdsPersonnelCollection = New ChdsPersonnelCollection Dim filter As PredicateExpression = New PredicateExpression()

            filter.Add(New FieldCompareSetPredicate(ChdsPersonnelFields.PersonnelId, Nothing, _
                                                    DelegationFields.Delegatee, Nothing, _
                                                    SetOperator.In, _
                                                    (DelegationFields.PersonnelId = 96242)))


            retVal.GetMulti(filter)

            Return retVal

However, as soon as the GetMulti statement executes, I get an exception ("Object reference not set to an instance of an object")

The trace of the code (using Diagnostic switches) looks like this:

Method Enter: DaoBase.PerformGetMultiAction Method Enter: CreatePagingSelectDQ Method Enter: CreateSelectDQ Method Enter: CreateSelectDQ Method Enter: CreateSubQuery Method Enter: CreateSelectDQ Method Enter: CreateSelectDQ

Please help

Arvinder Chopra

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-May-2007 08:58:37   

I think you are using an overload of FieldCompareSetPredicate that belongs to the Adapter model, while you are using the SelfServecing model.

Please try the following code instead:


                Dim retVal As ChdsPersonnelCollection = New ChdsPersonnelCollection
                Dim filter As PredicateExpression = New PredicateExpression()

                filter.Add(New FieldCompareSetPredicate(ChdsPersonnelFields.PersonnelId,  _
                                                        DelegationFields.Delegatee,  _
                                                        SetOperator.In, _
                                                        (DelegationFields.PersonnelId = 96242)))
                retVal.GetMulti(filter)