The system chooses hibernate or MyBatis on the framework of the Operation database.
First of all, the principle of the two, assuming you want to correlate several tables to do the query, to find out 20 records:
1. Assume that MyBatis
SELECT *
From (SELECT inner_table.*, ROWNUM outer_table_rownum
From (select Sp_work_plan.name, Sprocorgan1_.code--just query
From Sp_work_plan workplanvo0_,
V_sp_organization sprocorgan1_,
V_sp_user sprocuserv2_,
V_sp_organization sprocorgan3_,
V_sp_user sprocuserv4_,
V_sp_user sprocuserv5_,
V_sp_organization sprocorgan6_
From workplanvo0_. Apply_department_oid =
SPROCORGAN1_.ORG_ID and
workplanvo0_. Confirmation_uid = sprocuserv2_. USER_ID and
sprocuserv2_.org_id = Sprocorgan3_.id and
workplanvo0_. Create_uid = sprocuserv4_. USER_ID and
workplanvo0_. Work_master_uid = sprocuserv5_. USER_ID and
workplanvo0_. work_team_id = sprocorgan6_.org_id) inner_table
WHERE ROWNUM <=) outer_table
WHERE outer_table_rownum > 0;
2. Assume that hibernate, like the following SQL to check 20 times.
Select
Workplanvo0_.id as Id9_6_,
workplanvo0_. Update_time as Update2_9_6_,
workplanvo0_. Optimistic_lock_version as Optimistic3_9_6_,
workplanvo0_. CODE as Code9_6_,
workplanvo0_. Data_from as Data5_9_6_,
workplanvo0_. Data_state as Data6_9_6_,
workplanvo0_. End_lifecycle as End7_9_6_,
Workplanvo0_.name as Name9_6_,
workplanvo0_. Start_lifecycle as Start9_9_6_,
workplanvo0_. Flow_state as Flow10_9_6_,
workplanvo0_. process_ins_id as Process11_9_6_,
workplanvo0_. Actual_end_time as Actual12_9_6_,
workplanvo0_. Actual_start_time as Actual13_9_6_,
workplanvo0_. Apply_department_oid as Apply40_9_6_,
workplanvo0_. Attention_level as Attention14_9_6_,
Workplanvo0_.complete_condition as Complete15_9_6_,
workplanvo0_. Confirmation_time as Confirm16_9_6_,
workplanvo0_. Confirmation_uid as Confirm41_9_6_,
workplanvo0_. Create_uid as Create42_9_6_,
Sprocorgan1_.id as id26_0_,
Sprocorgan1_. Update_time as update2_26_0_,
Sprocorgan1_. Optimistic_lock_version as optimistic3_26_0_,
Sprocorgan1_. CODE as code26_0_,
Sprocorgan1_. Data_from as data5_26_0_,
Sprocorgan1_. Data_state as data6_26_0_,
Sprocorgan1_. End_lifecycle as end7_26_0_,
Sprocorgan1_.name as name26_0_,
Sprocorgan1_. Start_lifecycle as start9_26_0_,
Sprocorgan1_. area_id as area10_26_0_,
Sprocorgan1_. State as State26_0_,
Sprocuserv2_.id as Id27_1_,
Sprocuserv2_. Update_time as Update2_27_1_,
Sprocuserv2_. Optimistic_lock_version as Optimistic3_27_1_,
Sprocuserv2_. CODE as Code27_1_,
Sprocuserv2_. Data_from as Data5_27_1_,
Sprocuserv2_. Data_state as Data6_27_1_,
Sprocuserv2_. End_lifecycle as End7_27_1_,
Sprocuserv2_.name as Name27_1_,
Sprocuserv2_. Start_lifecycle as Start9_27_1_,
Sprocuserv2_. Account as account27_1_,
Sprocorgan3_.id as Id26_2_,
Sprocorgan3_. Update_time as Update2_26_2_,
Sprocorgan3_. Optimistic_lock_version as Optimistic3_26_2_,
Sprocorgan3_. CODE as Code26_2_,
Sprocorgan3_. Data_from as Data5_26_2_,
Sprocorgan3_. Data_state as Data6_26_2_,
Sprocuserv4_.id as Id27_3_,
Sprocuserv4_. Update_time as Update2_27_3_,
Sprocuserv4_. Optimistic_lock_version as Optimistic3_27_3_,
Sprocuserv4_. CODE as Code27_3_,
Sprocuserv4_. Data_from as Data5_27_3_,
Sprocuserv4_. Data_state as Data6_27_3_,
Sprocuserv4_. End_lifecycle as End7_27_3_,
Sprocuserv4_.name as Name27_3_,
Sprocuserv5_.id as Id27_4_,
Sprocuserv5_. Update_time as Update2_27_4_,
Sprocuserv5_. Optimistic_lock_version as Optimistic3_27_4_,
Sprocuserv5_. CODE as Code27_4_,
Sprocuserv5_. Data_from as Data5_27_4_,
Sprocuserv5_. Data_state as Data6_27_4_,
Sprocuserv5_. End_lifecycle as End7_27_4_,
Sprocorgan6_.id as Id26_5_,
Sprocorgan6_. Update_time as Update2_26_5_,
Sprocorgan6_. Optimistic_lock_version as Optimistic3_26_5_,
Sprocorgan6_. CODE as Code26_5_,
Sprocorgan6_. Data_from as Data5_26_5_,
Sprocorgan6_. Data_state as Data6_26_5_,
Sprocorgan6_. End_lifecycle as End7_26_5_,
Sprocorgan6_.name as Name26_5_,
Sprocorgan6_. Start_lifecycle as Start9_26_5_,
Sprocorgan6_. State as State26_5_
From
Sp_work_plan workplanvo0_
Left OUTER JOIN
V_sp_organization sprocorgan1_ on workplanvo0_.apply_department_oid=sprocorgan1_.org_id
Left OUTER JOIN
V_sp_user sprocuserv2_ on workplanvo0_. Confirmation_uid=sprocuserv2_. user_id
Left OUTER JOIN
V_sp_organization sprocorgan3_ on Sprocuserv2_.org_id=sprocorgan3_.id
Left OUTER JOIN
V_sp_user sprocuserv4_ on workplanvo0_. Create_uid=sprocuserv4_. user_id
Left OUTER JOIN
V_sp_user sprocuserv5_ on workplanvo0_. Work_master_uid=sprocuserv5_. user_id
Left OUTER JOIN
V_sp_organization sprocorgan6_ on workplanvo0_.work_team_id=sprocorgan6_.org_id
where workplanvo0_.id=?;
1. Impact of the design phase
The rationality and prediction performance of the model cannot be verified. According to the interface prototype database design, the advantage is to ensure that data can be stored in the data, the shortcomings of the model can not guarantee the reasonable and performance.
Assuming that the tuning architecture is ibatis, we can write the complex query out before writing the code after the design is finished, making some data for performance prediction.
2. Impact of the development phase
A.hibernate cannot use hierarchical queries, analytic functions, regular tables, and so on. Not bad. Hibernate has the result of invoking SQL. Assuming that SQL is invoked through an interface, it is not easy to debug, and Ibatis is good for debugging.
B. It is also impossible to predict performance during the development phase, which is to test SQL.
The internal implementation of the c.hibernate is more complex. Suppose no one can read the source code inside. It is best to use only the simplest of increases, deletions, and changes. Check (based on primary key). Anti-MyBatis, achieve very easy. Hold.
3. Impact of the operations phase
It is the best practice in the industry to monitor the database every day in operation and find the performance hidden trouble.
Assuming that the schema is hibernate, even if we find the problem SQL, we cannot tune the modified SQL. Because it is generated for processing. Add one more index.
Finally: The practical hibernate operates on the DB. Consider hibernate as a SQL-generated tool. The fact is that the database is treated as a black box. It seems that there is no need to have an in-depth understanding of it, which is misleading to look at some of the development tools we have developed today, assuming that we are experiencing large amounts of data and often take a break.
My comparison of hibernate and MyBatis frameworks