One-to-multiple IBatis configurations

Source: Internet
Author: User

One-to-multiple IBatis configurations

------- Description -------- IBatis version 2.0 configures one-to-multiple namespace = testDao ----------------/*** class resultMap * ClassBean corresponding to bean such as org. test. classBean * id is a unique identifier */<resultMap class = "ClassBean" id = "classBean_result"> <result column = "db_id" property = "id"/> <result column = "db_name" property = "name"/> <result column = "db_id" property = "studentList" select = "testDao. selectStudent "/> // The format is namespace. selecctvoid description </resultMap>/*** student Class resultMap * studentBean corresponding to Bean such as org. test. studentBean * id is a unique identifier **/<resultMap class = "studentBean" id = "studentBean_result"> <result column = "id" property = "id"/> <result column = "db_name" property = "name"/> </resultMap> <select id = "selectStudent" parameterClass = "java. lang. string "resultMap =" studentBean_result "> select * from table_student where class_id = # value # // This name can be customized because the parameter is java. lang. string. There is a parameter </select> <select id = "selectClass" parameterClass = "java. util. map "resultMap =" classBean_result "> select * from table_calss where 1 = 1 </select> is the one-to-multiple relationship configuration of IBatis. It is easy to maintain. Every multiple party sends an SQL statement to occupy resources.

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.