What's the difference between entity and class?

前端 未结 7 1087
孤独总比滥情好
孤独总比滥情好 2020-12-23 11:01

Is entity an instance of class?

7条回答
  •  不思量自难忘°
    2020-12-23 11:42

    Entities

    An entity is a lightweight persistence domain object. Typically an entity represents a table in a relational database, and each entity instance corresponds to a row in that table. The primary programming artifact of an entity is the entity class, although entities can use helper classes. The persistent state of an entity is represented either through persistent fields or persistent properties. These fields or properties use object/relational mapping annotations to map the entities and entity relationships to the relational data in the underlying data store.

    Entity classes have a stereotype of entity. An entity class is essentially an object wrapper for a database table. The attributes of an entity are transformed to columns on the database table. Entities can have various data maintenance operations such as read, insert, modify, remove, readmulti (read multi reads multiple records from a table based on a partial key).

    Entities can have attributes, operations, dependencies, inherits relations, and aggregations. A set of rules is associated with each of these constructs.

    • Entity class rules
      Entities must have at least one attribute. The exception is if the entity is a subclass of another entity, in which case the entity must have no attributes. Entities are not allowed to aggregate other classes.

    • Entity attributes
      Entity attributes correspond to columns with the same name on their associated database table.

    • Entity operations
      Entity operations can be divided into two categories as determined by their stereotype: database and non-database operations.

    • Entity outputs
      Entity classes are transformed into classes with operations and no attributes. The attributes from the entity in the input meta-model are transformed into one or more structs.

    • Entity class options
      The options available for entity classes are entity class abstracts, allow optimistic locking, audit fields, enable validation, last updated field, No Generated SQL, and replace superclass.

    • Optimistic locking for concurrency control
      Using optimistic locking for concurrency control means that more than one user can access a record at a time, but only one of those users can commit changes to that record.

    • Table-level auditing
      Use the Database table-level auditing option to enable table-level auditing.

    • Exit points
      An exit point is a callback function that you write. It is executed at a predefined strategic point by the server.

    • Entity inheritance
      Input meta-model entity classes can subclass other entity classes.

    • Last updated field
      The last updated field is a field that you can add to database tables to contain extra information about the modification time of each record for reporting purposes.

    Also you can check this link and this link for more information!

提交回复
热议问题