When I was in use mybatis I very don't understand, the framework is a powerful place, I'm in. Netsql underlying encapsulation and code generator can complete mybatis mentioned characteristics, I also baidu once, most of the points 2 class, one is said ali the company USES the direct copy, the second part is what to say with this big project, also don't know what to say the definition of a large project is how to define the
CodePudding user response:
Mybatis write SQL, so with more peopleCodePudding user response:
Just a matter of learning, is a orm framework, mainly is the SQL code separation with convenient managementCodePudding user response:
Mybaits did two thingsOne is the ORM, Object - Relationl Mapping, Mapping database objects and Java objects.
Another is the separation of SQL and Java, enhance the readability of SQL.
If you want to compare with JPA, mybatis query is relatively flexible, but this is the advantages and disadvantages, advantage is flexible, defect is not controllable, the same as framework, framework is not only promote efficiency, also write garbage code rules
CodePudding user response:
Mybatis to get a business will be at least 6 different file (controller, a Service interface, ServiceImpl, Entity, Mapper and XML) and its form a complete set, the individual feels is too trival,CodePudding user response:
JDBC know!CodePudding user response:
Turned to other language object-oriented unpleasant is normal, you can also try ibatis, although the official has abandoned maintenance, but can, but you said than JDBC is going too far, however, at least the somebody else is based on JDBC extension,Switch the connection, access the first think you have a better way, but to write SQL, you see the following two which is more clear
SQL +="select NVL (t1)" + map. Get (" typ ") + ", '-') \ "typName ", \ r \ n "+
"To_char (count (1)) " typNum \ ", \ r \ n "+
"'" + map. Get (" typ ") + "' " _typCondition \ \ r \ n "+"
"From bbb_base_bbb t1 \ r \ n +"
"Where 1=1 \ r \ n" +
='20191118'. "and t1 acct_date \ r \ n" +
"" + map. Get (" sqlCondition") + "\ r \ n" +
"Group by NVL (t1)" + map. Get (" typ ") + ", '-') \ r \ n "+
"The order by count (1) the desc";
select NVL (t1) $typ $, '-') "typName,"
To_char (count (1)) "typNum,"
'${typ} "_typCondition
"The from BBB. Base_bbb t1
Where 1=1
And t1. A_date='20191118'
The ${sqlCondition}
Group by NVL (t1) ${typ}, '-')
The order by count (1) desc
XML format for 5 seconds enough know SQL to write what, if it is hundreds of lines of more obvious, because you can't stick Java string directly into the pl/SQL execution, on the console print, written in the Java logic is also can't see,
As for the 4th floor said six files trival, if you want, just need to XML file can run zero configuration,
CodePudding user response:
Mybatis is also reading these days, compared to NET Linq is really is too weak, Java have similar, Lambda SQL frameworkCodePudding user response:
Suggest you go see mybatis plusCodePudding user response:
You want to use ado.net + dbhelper, can see the JDBC + sqlhelperCodePudding user response:
Go to dark horse Java data, there is a custom mybatisCodePudding user response: