Tuesday, October 11, 2005

Tired of SQL

Object Relation mapping tool

O/R Mapping means Object/Relation Mapping. All of our application deals with objects as well as relational database.

A typical application consist of three layers namely

  • Presentation Layer
  • Business logic layer
  • Data Access Layer

Now if we consider using of objects, we find that Objects are used in Presentation and business layer, but our Data access layer works with Relational database, which is very different from how we access our objects. Today any world application is been handled in OO fashion. Wasn’t it something great if we access our Relational database in OO manner. Before we go further, its also needed as when we talk about our data access layer , we find that Data Access Layer is responsible for any code to save, delete, and retrieve your object from the database. You write methods in your DAL to retrieve different sets of objects, change status', and perform various other tasks. Writing this data access code *can be* very repetitive. To avoid this , now we use ORM tool rather than DAL. Yes, that’s true. Now we didn’t need to write those Insert, Update, Delete and Select statement , these all things is carried by our O/R Mapping tool. So now we have scenario something like this

Objects ----- ORM Mapper ----Relational Database

It is a common scene that our objects does not have 100% exact mapping with the database columns. For e.g. , we might be interested in having the having one column in the table which resembles two column in the Objects or vice versa. There is also the name conflict which means that what it means as Fname in the object resembles FirstName in some table of some database. So what we need is a mapping between those objects and relational database. What GNOME is doing is that it is It generates the data access layer from the class model and schema mapping to the relational model provided by the developer. This introduces object-oriented concepts and true refactoring down to the data access logic tier

Presently i am working with such a product called Genome. Initially, it might raise a kind of confusion and hustle-bustle for developers as most of them are familiar with those SQl Statements, but this is something i belive will be the future implementation of accessing the database as we can really accessing our Database in a OO manner. In Genome, rather than using SQL, we access the data through persistent classes and also have its own language called OQL. Unlike Sql, OQL is a case sensitive language. so Guys, traditional mechanism of accessing the data needs to be changed in the coming years. This forsight is also getting implemented in few of products of Microsoft. Any Guesses

No comments: