Top 10 Must Have Features in O/R Mapping Tools
Feature 1: Flexible object mapping
Everything in O/R mapping starts with mapping your objects to your relational tables. Here are some specific features in this area that you should know:
- Tables & views mapping
The tool should let you map objects to both tables and views in your relational database. Mapping to views is important because many real-life applications prefer to use views instead of tables. - Multi-table mapping
The tool should let you map an object not only to a single table but also to multiple tables and specify a join between these tables. If your application needs to fetch list of rows that span multiple tables (a common occurrence in web applications), you'll need this feature. - Naming convention
The tool should let you use a different naming convention in objects and their attributes than in relational databases. If your database table is named t_employees, your object may need to be named Employee. - Attribute mapping
There are a number of features that the tool should support:- Primary key
Your object must distinguish the primary key from other columns. It should also let you use a single-column or multi-column primary key. - Auto generated columns
Some columns are auto generated (IDENTITY or SEQUENCE) and your object must have code to handle fetching the generated values after an insert. - Read-only columns
Some columns are not meant to be set by the client but instead their values are system generated (e.g. creation_dtime column using getDate() function in SQL Server). Your object must have appropriate code to fetch these system-generated values. - Required columns
Your object must do data validation for required columns at the time of insert or update operations. This is much more efficient than wasting a trip to the database just to get an error message back. - Validation
In most cases, you have defined various constraints on your database columns. It would be nice to have the same validations done in your persistence objects so you can save an unnecessary trip to the database just to receive an error message. - Formula Fields
There are many situations where when you fetch data from the database, you use a regular expression rather than a column (e.g. Annual Salary object attribute might be a formula field monthly_salary * 12). - Data type mapping
Sometime, you want to map one data type from the database to another data type in your object. For example, a datetime type might be converted into a string. Your object must have the logic to do this automatically in both directions (read and write).
- Primary key
Previous Page | Next Page
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
If you found this page useful, bookmark and share it on:
Embedded Star Newsletter
Don't have time to visit Embedded Star everyday? Then sign up for our free newsletter. We'll send you an email when we have something to share with you. Your email address will be kept confidential and we will not share, sell, or rent it to anyone. You can unsubscribe at any time by clicking a link in the email.
If you are familiar with RSS feeds, you can also sign up for our free blog feed. Our RSS feed is updated in real-time while our newsletter is updated daily.
