Skip to main content

Features Specific to Persistent Classes

Features Specific to Persistent Classes

Persistent classes can include several kinds of class members that are not meaningful in other types of classes:

  • Storage definitions, which govern access for the data for the class.

  • Indices. An index can define the unique identifier for objects in the class; see The Object ID.

    An index can also add a constraint that ensures uniqueness of a given field or combination of fields. For information on such indexes, see Defining Persistent Classes.

    Another purpose of an index is to define a specific sorted subset of commonly requested data associated with a class, so that queries can run more quickly. For example, as a general rule, if a query that includes a WHERE clause using a given field, the query runs more rapidly if that field is indexed. In contrast, if there is no index on that field, the engine must perform a full table scan, checking every row to see if it matches the given criteria — an expensive operation if the table is large. See Other Options for Persistent Classes.

  • Foreign keys, which establish referential integrity constraints between tables used when data is added or changed. If you use relationship properties, the system automatically treats these as foreign keys. But you can add foreign keys if you do not want to use relationships or if you have other reasons to add them.

    For more information on foreign keys, see Other Options for Persistent Classes.

  • Triggers, which define code to be executed automatically when specific events occur, specifically when a record is inserted, modified, or deleted.

    For more information on triggers, see Other Options for Persistent Classes.

Also note that a class method or a class query can be defined so that it can be invoked as a stored procedureOpens in a new tab, which enables you to invoke it from SQL.

FeedbackOpens in a new tab