Entity 오브젝트에 이루어진 변경사항으로 데이터베이스를 업데이트합니다.
Entity 오브젝트가 편집 가능한 경우에만 이 메소드를 호출할 수 있습니다. 기존의 Entity 오브젝트를 편집 가능하게 만들려면 Session 오브젝트의 EditEntity 메소드를 호출하십시오. Entity 오브젝트의 IsEditable 메소드를 사용하여 예외 처리의 일부로서 확약 오퍼레이션을 되돌려야 하는지 여부를 판별할 수 있습니다. 모든 유효성 검증 실패를 되돌리고자 하지 않을 수도 있으며 Revert 메소드를 호출해도 확약이 완료된 이후에는 작동하지 않습니다(엔티티가 이미 데이터베이스에 확약되어 사후 알림(post-notification) 경고가 리턴된다 할지라도).
실패 시, 메소드는 실패 원인에 따라 오류 메시지 또는 예외를 포함하는 문자열을 리턴합니다. 예를 들어, 메소드는 실패에 대한 오류 메시지(예: 값 세트가 필드에 올바르지 않음)를 포함하는 문자열을 리턴할 수 있습니다. 그러나, 메소드에서 기타 실패에 대한 예외(편집 가능한 상태에 있지 않은 엔티티를 변경하려 함)가 발생할 수도 있습니다. 따라서, 코드에서 발생 가능성이 있는 두 가지 실패 유형 모두를 처리해야 합니다. 자세한 정보는 오류 검사 및 유효성 검증을 참조하십시오. 조치 확약 후크 예제에 Commit 메소드를 호출할 때 발생하는 오류 및 예외 예제가 제공되어 있습니다.
VBScript
' Modify the record and then commit the changes. set sessionObj = GetSession set entityObj = sessionObj.GetEntity("defect", "BUGID00000042") sessionObj.EditEntity entityObj, "modify" ' ... modify the Entity object ' your code should also check for exceptions status = entityObj.Validate if status = "" then status = entityObj.Commit if status = "" then ' successful commit else 'check error message end if else entityObj.Revert end if ' The Entity object is no longer editable
Perl
# Modify the record and then commit the changes. $sessionObj = $entity->GetSession(); $entityObj = $sessionobj->GetEntity("defect","BUGID00000042"); $sessionObj->EditEntity($entityobj,"modify"); # Modify the entity object # Your code should also check for exceptions $status = $entityObj->Validate(); if ($status == ""){ $status = $entityObj->Commit(); if ($status == ""){ # successful commit } else { # check error message } else { $entityObj->Revert(); } # The entity object is no longer editable.