关于O-R映射的有一些模式可以用, 摘自Connecting Business Objects to Relational DatabasesPersistence Layer Provide a layer for mapping your objects to the RDBMS or other database.CRUD All persistent object need, at a minimum, create, read, update, and delete operations.SQL Code Description Defines the actual SQL code that takes the values from the RDBMS or other database and retrieves them for the object’s use and vice-versa. It is used to generate the SQL for performing the CRUD operations.Attribute Mapping Methods Maps the values between the database values and attributes. This pattern also handles complex object mappings. Populates the object(s) with the row values. Type Conversion Works with Attribute Mapping Methods to translates values from the database to the appropriate object types and vice-versa. Insures data integrity.Change Manager Keeps track of when an object’s values have been changed for maintaining consistency with the database. It determines the need to write the values to a database table or not.OID Manager Generates Unique Keys for the Object Ids during an insert. Transaction Manager Provides a mechanism to handle transactions while saving objects.Connection Manager Gets and maintains a connection to the database.Table Manager Manages the mappings from an object to its database table(s) and column(s).
摘自Connecting Business Objects to Relational DatabasesPersistence Layer
Provide a layer for mapping your objects to the RDBMS or other database.CRUD
All persistent object need, at a minimum, create, read, update, and delete
operations.SQL Code Description
Defines the actual SQL code that takes the values from the RDBMS or other
database and retrieves them for the object’s use and vice-versa. It is used to
generate the SQL for performing the CRUD operations.Attribute Mapping Methods
Maps the values between the database values and attributes. This pattern also
handles complex object mappings. Populates the object(s) with the row values.
Type Conversion Works with Attribute Mapping Methods to translates values from the database to
the appropriate object types and vice-versa. Insures data integrity.Change Manager
Keeps track of when an object’s values have been changed for maintaining
consistency with the database. It determines the need to write the values to a
database table or not.OID Manager
Generates Unique Keys for the Object Ids during an insert.
Transaction Manager Provides a mechanism to handle transactions while saving objects.Connection Manager
Gets and maintains a connection to the database.Table Manager
Manages the mappings from an object to its database table(s) and column(s).