Current filter:
                                You should refresh the page.
                                0
                                  • Hi Guys,

                                    i have a strange problem with an XPQuery with intransaction mode.

                                    foreach (var item in from r in new XPQuery<SalesLineItem>(_session, true)
                                                                         where r.OrderLineItem != null
                                                                         && r.OrderLineItem.Oid == lineitem.Oid
                                                                         select r)

                                    The above linq results in this sql query:

                                    exec sp_executesql N'select ..... from ((((("dbo"."SalesLineItem" N0
                                     inner join "dbo"."LineItemBase" N1 on (N0."Oid" = N1."Oid"))
                                     left join "dbo"."BaseDocument" N2 on (N1."Document" = N2."Oid"))
                                     left join "dbo"."ArticleBase" N3 on (N0."Article" = N3."Oid"))
                                     left join "dbo"."Unity" N4 on (N0."Unity" = N4."Oid"))
                                     left join "dbo"."PurchaseDetails" N5 on (N0."PurchaseDetails" = N5."Oid"))
                                    where (N1."GCRecord" is null and not (N0."OrderLineItem" is null)

                                    BUT if i remove the transaction parameter:

                                    foreach (var item in from r in new XPQuery<SalesLineItem>(_session)
                                                                         where r.OrderLineItem != null
                                                                         && r.OrderLineItem.Oid == lineitem.Oid
                                                                         select r)

                                    The query is correct:

                                    exec sp_executesql N'select .... from ((((("dbo"."SalesLineItem" N0
                                     inner join "dbo"."LineItemBase" N1 on (N0."Oid" = N1."Oid"))
                                     left join "dbo"."BaseDocument" N2 on (N1."Document" = N2."Oid"))
                                     left join "dbo"."ArticleBase" N3 on (N0."Article" = N3."Oid"))
                                     left join "dbo"."Unity" N4 on (N0."Unity" = N4."Oid"))
                                     left join "dbo"."PurchaseDetails" N5 on (N0."PurchaseDetails" = N5."Oid"))
                                    where (N1."GCRecord" is null and not (N0."OrderLineItem" is null) and (N0."OrderLineItem" = @p0))',N'@p0 uniqueidentifier',@p0='80F01E6F-5183-4C33-A013-0F66B8BADDFA'

                                    To summarize - with intransaction mode - this r.OrderLineItem.Oid == lineitem.Oid where clause is ignored - why!??

                                0

                                Hi Noxe,

                                This behavior is correct. In InTransaction mode XPO removes some clauses from the query that may be affected by uncommitted changes and processes returned objects on the client side.

                                Thanks,
                                Michael.

                                0

                                hmm - scary - this query loads have of my database - where it should return 2 or 3 records - thats a huge performance impact! How else should i load my objects and also take into account my local ones?

                                0

                                Hi Noxe,

                                I am afraid we cannot improve the performance in an InTransaction mode because uncommitted data may unpredictably affect the result. In addition, we should also check whether objects have been changed in the database. I regret to inform you that there is no workaround. If you know which uncommitted objects should be included in the (BeforeTransaction) result list or removed from it, process them separately.

                                Thanks,
                                Michael.

                                0

                                Hi Michael,

                                i still dont understand, that when i request "where r.OrderLineItem != null && r.OrderLineItem.Oid == lineitem.Oid" from the database, XPO simply ignores my where condition and queries the database without where...? can you clarify why this is done?

                                0

                                Hi Noxe,

                                It is rather difficult to determine which objects actually need to be retrieved. For example, we have class Person that has a reference property pointing to class Address. We have loaded some Address object and changed the City property to "London". Now we wish to retrieve Persons with Address.City='London'. If we do not remove criteria from the query, it will return only Persons that meet the criterion in the database, but miss Persons that refer to a modified Address object. If we do not load Persons referring to that Address object before modifying it, we cannot even add them manually to the result collection.

                                In previous versions we simply remove filter criteria from the query in InTransaction mode. In version 10.1 we improved the InTransaction mode logic to detect certain situations that can be optimized. Your scenario seems to be more complicated. We do not consider the current behavior as a bug because the result is correct. If you provide us with a small sample project demonstrating your scenario, we will research whether or not it is possible to optimize queries. You are welcome to post a suggestion about this improvement.

                                Thanks,
                                Michael.

                                0

                                Hi Michael,

                                today i faced the same problem - even worser. It seems that some of the latest hotfixes changed again something in the Transaction loader, because our app stopped working because of OutOfMemory Exception because of InTransaction queries:

                                            collection.AddRange(new XPCollection(
                                                PersistentCriteriaEvaluationBehavior.InTransaction,
                                                _session,
                                                _session.GetClassInfo(lineitem),
                                                operand == lineitem.Oid & LineItemBase.Fields.ObjectType.Oid == objectType.Oid).Cast<PriceLineItem>());

                                See the query above - i search for an LineItem object where the operand equals the objects OID - and is of a specifiy type. XPO removes the query operand == lineitem.Oid - and queries the whole database, the result is a outofmemory exception.

                                How can i avoid that???

                                0

                                I did some tests now:

                                11.1.8 - code works
                                11.1.8.11280 - code works
                                11.1.8.11294 - whole table is loaded !?

                                0

                                Hi Noxe,

                                Thank you for your report. We have reviewed the most recent changes of our code but cannot find a possible cause for this behavior. Would you please provide us with a small sample project reproducing this issue?

                                Thanks,
                                Michael.

                                0

                                Hi Michael,

                                i also checked your source and between 11280 and 11294 you did some changes in the intransactionloader which is actually breaking the functionality. its annoying that i always have to proove there is a problem - preparing such an example will again need much time, dont counting the time i already spent today in debugging the problem...

                                0

                                Why do you publish an hotfix where nothing was changed? I downloaded the hotfix and compared the sources, no change was made in this regard....?

                                0

                                Hi Noxe,

                                Thank you for the update. I was in a hurry to provide you with a hot-fix that uploaded the incorrect build. I apologize for that.
                                I am now uploading a nightly build at http://downloads.devexpress.com/Share/DXP/111114/DXperience-11.1.8.11319.exe
                                You will be able to access it in 10-15 minutes or so. Please let us know if this helps.

                                Thanks,
                                Dennis

                                You must  log in  or  register  to leave an answer

                                Is your intention to post an answer to your own question?

                                • If so, then proceed.
                                • If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
                                • If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.