In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the example analysis of iBATIS.NET multi-table query method, the content is very detailed, interested friends can refer to, hope to be helpful to you.
What is the method of iBATIS.NET multi-table query? Let's learn from examples step by step:
Create two tables Account and Degree, use Account_ID association, and need to find out all the records of the two tables.
First, modify the entity class by adding the following attributes:
Private Degree _ degree; public Degree Degree {get {return _ degree;} set {_ degree = value;}}
Then: modify the configuration file, which is also the most important part (the configuration file in PS:iBATIS.NET is really strong)
In the resultMaps section, add:
< resultMap id= "com2result" class= "Account" > < result property= "Id" column= "Account_ID" / > < result property= "FirstName" column= "Account_FirstName" / > < result property= "LastName" column= "Account_LastName" / > < result property= "EmailAddress" column= "Account_Email" nullValue= "no_email@provided.com" / > < result property= "Degree" resultMapping= "Account.Degree-result" / > < resultMap id= Degree-result "class=" Degree "> < result property=" Id "column=" Account_ID "/ > < result property=" DegreeName "column=" DegreeName "/ > < / resultMap >
The most important thing here is to use the resultMapping attribute, resultMapping= "Account.Degree-result", where Account is the namespace of the current configuration file:
< sqlMap namespace= "Account".
In the states section, add:
< select id= "GetCom2Tables" resultMap= "com2result" > select Accounts.*, Degree.* from Accounts,Degree where Accounts.Account_ID = Degree.Account_ID < / select >
In this way, you can write the sql you need as much as you like, and the performance is very good, so that there will not be a query statement of 1roomn in the third method.
Then, iBATIS.NET multi-table query method will be introduced to you here, I hope it will be helpful for you to understand iBATIS.NET multi-table query method.
This is the end of the sample analysis of the iBATIS.NET multi-table query method. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.