InterviewSolution
| 1. |
Is Ibatis The Best Choice For My Project? |
|
Answer» iBATIS is a Data Mapping tool. Its role is to map the columns of a database query (including a stored procedure) to the properties of an object. If your APPLICATION is based on business objects (including Maps or IDictionary objects), then iBATIS can be a good choice. iBATIS is an even better choice when your application is layered, so that that the business layer is distinct from the userinterface layer. Under these CIRCUMSTANCES, another good choice would be an Object/Relational Mapping tool (OR/M tool), like HIBERNATE or NHibernate. (Other products in this category are Apache ObjectRelationalBridge and Gentle.NET.) An OR/M tool generates all or most of the SQL for you, either beforehand or at runtime. These products are called OR/M tools because they try to map an object graph to a relational schema. iBATIS is not an OR/M tool. iBATIS helps you map objects to stored procedures or SQL statements. The underlying schema is irrelevant. An OR/M tool is GREAT if you can map your objects to tables. But they are not so great if your objects are stored as a relational view rather than as a table. If you can write a statement or procedure that exposes the columns for your object, regardless of how they are stored, iBATIS can do the rest. So, how do you decide whether to OR/M to DataMap? As always, the best advice is to implement a representative PART of your project using either approach, and then decide. But, in general, OR/M is a good thing when you
Likewise, the best time to use a Data Mapper, like IBATIS, is when:
In the end, you have to decide what’s best for your project. If a OR/M tool works better for you, that’s great! If your next project has different needs, then we hope you give iBATIS another look. iBATIS is a Data Mapping tool. Its role is to map the columns of a database query (including a stored procedure) to the properties of an object. If your application is based on business objects (including Maps or IDictionary objects), then iBATIS can be a good choice. iBATIS is an even better choice when your application is layered, so that that the business layer is distinct from the userinterface layer. Under these circumstances, another good choice would be an Object/Relational Mapping tool (OR/M tool), like Hibernate or NHibernate. (Other products in this category are Apache ObjectRelationalBridge and Gentle.NET.) An OR/M tool generates all or most of the SQL for you, either beforehand or at runtime. These products are called OR/M tools because they try to map an object graph to a relational schema. iBATIS is not an OR/M tool. iBATIS helps you map objects to stored procedures or SQL statements. The underlying schema is irrelevant. An OR/M tool is great if you can map your objects to tables. But they are not so great if your objects are stored as a relational view rather than as a table. If you can write a statement or procedure that exposes the columns for your object, regardless of how they are stored, iBATIS can do the rest. So, how do you decide whether to OR/M to DataMap? As always, the best advice is to implement a representative part of your project using either approach, and then decide. But, in general, OR/M is a good thing when you Likewise, the best time to use a Data Mapper, like IBATIS, is when: In the end, you have to decide what’s best for your project. If a OR/M tool works better for you, that’s great! If your next project has different needs, then we hope you give iBATIS another look. |
|