It sets object id directly instead of setting oref.

Consider these 2 classes:

Class Person Extents %Persistent {

Property EmployedAt As Company;

}


Class Company Extends %Persistent {

}

Usually you assign Company to Person this way:

set person = ##class(Person).%New()
set companyId = 123
set company = ##class(Company).%OpenId(companyId)
set person.EmployedAt = company

But with PropertySetObjectId you can expedite things

set person = ##class(Person).%New()
set companyId = 123
do person.EmployedAtSetObjectId(companyId)

The main advantage is that company object doesn't have to be opened.

Are you sure about:

Property PatientId As %Stream.FileCharacter;
Property PatientName As %Stream.FileCharacter;

Both of these fields are less than 3 641 144 characters in size, so

Property PatientId As %VarString;
Property PatientName As %VarString;

Would probably work.

You can add ToStream() method to your class to provide serialization, if you need to (Or just add JSON or XML adaptors to generate XML or JSON (de)serializations automatically).