Mybatis multi table associated query

This is the back-end small class of the monastery. Each article is shared from

[background introduction] [knowledge analysis] [common problems] [solutions] [coding practice] [extended thinking] [more discussion] [References]

Eight aspects of in-depth analysis of back-end knowledge / skills. This article shares:

[mybatis multi table associated query]

< span style="color:#333333;"> [java small class of Xiuzhen academy] mybatis multi table joint query

< span style="color:#333333;"> Hello, I'm the 12th College of Shenzhen Branch of it Academy. I'm an honest and pure java programmer. Today, I'd like to share with you to expand the knowledge point - mybatis multi table joint query.

< span style="color:#333333;"> (1) Background introduction

< span style="color:#333333;">< span style="color:#4f4f4f;"> In the objective world, objects rarely exist alone, such as the relationship between classes and students, the relationship between students and courses, and their instances can access each other, which is the correlation. Mybatis association mapping can greatly simplify the access of persistence layer data. The classification of association relations is as follows:

< span style="color:#333333;"> (2) Knowledge analysis

    < span style="color:#333333;"> Why is it not recommended to use foreign keys to associate multiple tables?

    < span style="color:#333333;"> (4) Solution

    < span style="color:#333333;"> For high concurrency and high traffic transaction scenarios, the use of foreign keys may easily lead to deadlock and faster bottleneck of database resources. Therefore, it is not recommended in the general Internet industry,

    < span style="color:#333333;"> Use more in-house, such as ERP software, early MIS system, etc.

    < span style="color:#333333;"> (5) Coding practice

    < span style="color:#333333;"> (6) Expand thinking

    < span style="color:#333333;"> (7) References

    < span style="color:#333333;"> [reference 1] < a class = "UI link" href=“ https://blog.csdn.net/u010858605/article/details/70145733 " rel="nofollow"> https://blog.csdn.net/u010858605/article/details/70145733

    < span style="color:#333333;"> [reference 2] < a class = "UI link" href=“ https://blog.csdn.net/lu1024188315/article/details/78758943 " rel="nofollow"> https://blog.csdn.net/lu1024188315/article/details/78758943

    < span style="color:#333333;"> (8) More discussion

    < span style="color:#333333;">< span style="color:#666666;"> Q1: questioner: how to use mybatis for batch query?

    < span style="color:#333333;">< span style="color:#666666;"> A1: respondent (can be a sharer or other participants): answer

    < span style="color:#333333;">< span style="color:#666666;"> Batch query:

    < span style="color:#333333;"> < span style="color:#333333;"><< span style="color:#008000;"> update id=< span style="color:#ba2121;"> "updateBatch" parameterType=< span style="color:#ba2121;"> "list">

     < span style="color:#333333;">< span style="color:#333333;">  update course  
        
         
         
           when id=#{item.id} then #{item.name} 
           
            
            
              when id=# {item.id} then #{item.title} where 
             
               id=#{item.id}
             
            
           
          
         
        
       
      

     < span style="color:#333333;">< span style="color:#333333;">

    < span style="color:#333333;">< span style="color:#666666;"> This sentence is equivalent to

    < span style="color:#333333;">< span style="color:#666666;"> Q2: questioner: how to perform batch insertion< span style="color:#666666;"> A2: respondent (can be a sharer or other participants): answer

      < span style="color:#333333;">< span style="color:#666666;"> A3: respondent (can be a sharer or other participants): answer

      < span style="color:#333333;">< span style="color:#666666;"> In fact, there is no difference between many to one and one to one mybatis configuration files, but which one is used as the main table is a little different in fields?

      < span style="color:#333333;"> (9) Acknowledge

      < span style="color:#333333;"> (10) Conclusion

      < span style="color:#333333;">< span style="color:#666666;"> That's all for today's sharing. You are welcome to like, forward, leave messages and make bricks~

      For more information, you can join the IT communication group 565734203 to discuss and communicate with you

      The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
      THE END
      分享
      二维码
      < <上一篇
      下一篇>>