Home > Class Reference > HSLIB namespace > HS.Util.SessionData.Session


persistent class HS.Util.SessionData.Session extends %Library.Persistent, %XML.Adaptor

SQL Table Name: HS_Util_SessionData.Session

This is a general purpose session class that can be used to manage the life cycle of any application data that should be cleaned up when a session ends.

The data that needs to be tied to such a session should extend AbstractSessionData, which leaves the main responsibility of the application developer to be the life cycle management of the Session object.

For CSP or REST applications that use sessions, the management should be implemented as a subclass of SessionEvents, but applications may use any management scheme that addresses their use case, provided the code calls the StartSession()() and EndSession()() methods on the intended Session class or subclass.

Property Inventory

Method Inventory


Flag that controls whether a transaction should be used to wrap the OnEndSession()() callback and the actual delete of the Session instance.


property Application as %String (COLLATION = "EXACT", MAXLEN = 100) [ Required ];

This property should be set to an application-specific value to allow multiple sessions for different applications and/or use cases to coexist within a single namespace.

NOTE: The following case-insensitive prefixes are reserved for use by HealthShare applications and MUST NOT be used by customer code:

  • "healthshare"
  • "hs"

Property methods: ApplicationDisplayToLogical(), ApplicationGet(), ApplicationGetStored(), ApplicationIsValid(), ApplicationLogicalToDisplay(), ApplicationLogicalToOdbc(), ApplicationNormalize(), ApplicationSet()
property SessionID as %String (COLLATION = "EXACT", MAXLEN = 50) [ Required ];
This value should be set to an application-specific session identifier. A natural fit for session-based CSP applications will be the CSP session ID.
Property methods: SessionIDDisplayToLogical(), SessionIDGet(), SessionIDGetStored(), SessionIDIsValid(), SessionIDLogicalToDisplay(), SessionIDLogicalToOdbc(), SessionIDNormalize(), SessionIDSet()


final classmethod CreateSession(Output pSession As HS.Util.SessionData.Session, pApplication As %String = "", pSessionID As %String = "", pDeleteExistingSession As %Boolean = 0, pContext...) as %Status [ Language = objectscript ]
API to create a new session object, which should be called on the intended Session class or subclass. Subclasses should override OnCreateSession()() to perform any additional initialization.
final classmethod EndSession(pApplication As %String = "", pSessionID As %String = "", pReason As %String = "") as %Status [ Language = objectscript ]
API to end a session and clean up all the related data. This API should be called on the Session class or subclass.


index (AppSession on Application,SessionID) [Unique];
Note that this index uses EXACT collation, primarily to support CSP session IDs.
Index methods: AppSessionCheck(), AppSessionCheckUnique(), AppSessionDelete(), AppSessionExists(), AppSessionOpen(), AppSessionSQLCheckUnique(), AppSessionSQLExists(), AppSessionSQLFindPKeyByConstraint(), AppSessionSQLFindRowIDByConstraint()

Inherited Members

Inherited Methods


Storage Model: Storage (HS.Util.SessionData.Session)



FeedbackOpens in a new window