UpdateEntitiesDirectly not updating the PK value

Posts   
 
    
methodman
User
Posts: 194
Joined: 24-Aug-2009
# Posted on: 25-Apr-2012 11:27:24   

Hi,

I have a table

UzivId - PK
ProjectId - PK
Note 

This is my code



            var projectUziv = new TfProjectsXfUzivEntity
            {
                UzivId = 1,
                Note = "ss"
            };

            var filter = new RelationPredicateBucket();
            filter.PredicateExpression.Add(TfProjectsXfUzivFields.ProjectId == 1);
            filter.PredicateExpression.Add(TfProjectsXfUzivFields.UzivId == 0);

            _adapter.UpdateEntitiesDirectly(projectUziv, filter);

and the generated code.


UPDATE "SMTAPP"."TF_PROJECTS_XF_UZIV" SET "NOTE"=:p1 WHERE ( ( ( "SMTAPP"."TF_PROJECTS_XF_UZIV"."PROJECT_ID" = :p2 AND "SMTAPP"."TF_PROJECTS_XF_UZIV"."UZIV_ID" = :p3)))

The point is the field UzivId doesn't get updated in the query.

I'm using the 3.1.0.0 and Oracle.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39910
Joined: 17-Aug-2003
# Posted on: 26-Apr-2012 09:56:18   

PK's can be updated, but only in single entity saves, so you update a PK field in an entity and save it again. Using direct updates won't update PK's.

Frans Bouma | Lead developer LLBLGen Pro