%Library.SerialObject
abstract serial class %Library.SerialObject extends %SwizzleObject
The %SerialObject class builds upon the functionality provided by the %RegisteredObject class and gives an object the ability to serialize itself and be embedded within another object.
Inventory
Parameters | Properties | Methods | Queries | Indices | ForeignKeys | Triggers |
---|---|---|---|---|---|---|
3 | 8 |
Summary
Parameters
$List
functions.
Methods
Returns a %Status value indicating success or failure.
%DeleteId is identical in operation to the %Delete method except that it uses and Id value instead of an OID value to find an object. Refer to About Concurrency for more details on the optional concurrency argument.
%GetSwizzleObject automatically detects and handles circular references between objects. For example, %GetSwizzleObject will detect if object A refers to object B and object B likewise refers to object A. In this case it will avoid falling into an infinite, recursive loop.
Note that either reference attribute, A to B or B to A, can be specified as being a required attribute but not both of them. If both reference attributes are required then %GetSwizzleObject will fail.
By default %GetSwizzleObject automatically manages transactions. You can enable and disable
automatic transaction support using the $$SetTransactionMode^%apiOBJ()
routine.
When %GetSwizzleObject serializes an object, it initiates one transaction (by calling TSTART) for the entire set of serializations, including the original object and any related objects. If the serialization operation is successful, %GetSwizzleObject will issue a TCOMMIT command to commit the transaction and write the data to the database. If %GetSwizzleObject encounters an error during the transaction it rolls back the entire transaction and performs the following actions:
- It issues a TROLLBACK command to rollback any changes to the database that may have occurred. (In the case of persistent objects with system assigned ids changes to the on-disk counter value, used to determine the next available object id number, are not rolled back.)
- It attempts to restore the in-memory state of all the objects involved in the transaction to their pre-transaction state. This includes restoring any modified flags, and restoring to null ("") any OID values that have been assigned during the course of the transaction. Additional property values changed during the course of the transaction are not restored, however.
- It calls the %RollBack method on each object involved with the transaction. The order in which the %RollBack methods are called is undefined. %RollBack will call a user-written %OnRollback method if it is present.
Returns a %Status value indicating success or failure.
%OpenId is identical in operation to the %Open method except that it uses and Id value instead of an OID value to find an object instance.
%OpenId returns an OREF value that refers to the in-memory object instance.