Paging:
Multi-Table Association query:
Multi-table operation
Temp table:
Stored procedure-Long statements:
A comparison between Hibernate and Ibatis
Blog Category:
IBATISHIBERNATESQL Data Structure ORM
1. Origin
Hibernate is currently the most popular O/R mapping framework, and it comes from sf.net and is now a part of JBoss.
Ibatis is another excellent O/R mapping framework that is now part of Apache's sub-project.
2. Principle
Ibatis is an ORM implementation of "SQL mapping" relative to Hibernate "O/R". Hibernate provides a more complete encapsulation of the database structure, and Hibernate's O/R mapping implements the mapping between Pojo and database tables, as well as the automatic generation and execution of SQL. Programmers often only need to define the Pojo to the database table mapping relationship, you can use Hibernate provides methods to complete the persistence layer operation. Programmers do not even need to be proficient in SQL, and HIBERNATE/OJB automatically generates the corresponding SQL and invokes the JDBC interface to execute according to the established storage logic.
The focus of Ibatis is the mapping relationship between Pojo and SQL. In other words, Ibatis does not automatically generate SQL execution for programmers at run time. The specific SQL needs to be written by the programmer, and then mapped to the specified Pojo by mapping the configuration file, the parameters required for SQL, and the returned result fields.
3. Mechanism
Using the ORM mechanism provided by Ibatis, for business logic implementations, the face is purely Java objects. This layer is basically consistent with the ORM implementation, and Hibernate automatically generates SQL statements for specific data operations, while Ibatis requires developers to write specific SQL statements. Relative to Hibernate, ibatis the workload of SQL development and the Compromise of database portability, which provides more free space for system design.
Hibernate vs. Ibatis:
4. Learning costs
Ibatis is very simple and easy to learn, hibernate is relatively complex, the threshold is higher.
5. Open Source software
Both are relatively good open source products.
6. Two-time development
When the system belongs to two development, unable to control and modify the database structure, the flexibility of ibatis will be more suitable than hibernate
7. Massive Data
The huge amount of system data processing and the extremely stringent performance requirements often mean that we have to achieve system performance design metrics through highly optimized SQL statements (or stored procedures). In this case, the Ibatis will have better controllability and performance.
8. Degree of automation
Ibatis requires a handwritten SQL statement, or a part of it, hibernate can be generated automatically, and occasionally some hql will be written. The same demand, ibatis a lot more work than hibernate. Similarly, if there are modifications to the database fields, there are few changes to hibernate, and ibatis to change those SQL mapping places one by one.
9. Relationship to data mapping
Ibatis in the database field one by one corresponding to the mapping of PO and Hibernte This object-based mapping of the PO is very different, the essential difference is that the PO is flat, unlike Hibernate map Po is able to express three-dimensional object inheritance, aggregation and so on, This will directly affect the design of your entire software system.
10. Technical Support
Hibernate is now the mainstream O/R mapping framework, from the richness of documents, product integrity, version development speed is stronger than Ibatis
The most critical sentence is the Ibatis's author says:
If you're starting a new project and you ' re in the full control of your object model and database design, Hibernate is a good Choice of O/R tool.
If you is accessing any 3rd party databases (e.g vendor supplied), or you ' re working with a legacy database, or even jus T a really poorly designed database, then an O/R mapper might not being capable of handling the situation. That's were an SQL mapper comes in handy
"Ask" represents ODBC, Ibatis questions Hibernate, Linq, Entity, JPA