Both plus globals.

NoSQL:

set obj = ##class(Sample.Person).%New()
set obj.Name = "John"
set obj.Spouse = #class(Sample.Person).%OpenId(1) // Let's assume it's a woman.

set sc = obj.%Save() // Use sc to know if any error happened.


SQL:

set s = ##class(%SQL.Statement).%New()
set sc = s.%Prepare("INSERT INTO Package.PersistentClass (property) VALUES (propertyValue)")
set sc = s.%Execute() // If everything is OK sc is 1, otherwise you might want to check s.%Message and s.%SQLCODE as well.


You can also use embedded SQL, search for "&sql" on the link I provided.

Globals

WARNING: I don't recommend any manipulation using globals directly if you 're working with classes.

Normally class globals are stored following the pattern below:

^Package.ClassNameI for index
^Package.ClassNameD for values
^Package.ClassNameS for streams

Check the class's Storage XML discover it's global structure.