Use ibatis to configure CDATA in an xml file

Source: Internet
Author: User
Ibatis, as a semi-automated ORMapping tool, is becoming more and more people tend to use it in projects. Because SQL is often used with xml specifications

Ibatis, as a semi-automated OR Mapping tool, is becoming more and more people tend to use it in projects. Because SQL is often used with xml specifications

Ibatis, as a semi-automated OR Mapping tool, is becoming more and more people tend to use it in projects. Because SQL statements often conflict with xml specifications, the validity of xml ing files is affected. Many people know how to use Mark to avoid conflicts, but some details need special attention when there are dynamic statements in the SQL configuration.

When using ibatis, you often need to configure the SQL statement to be executed. Anyone who has used ibatis knows that, inevitably, some incompatible and conflicting characters will be encountered. Most people also know that ibatis is used. Mark to prevent the legality of the xml ing file from being affected by characters that conflict with xml specifications in SQL. However, when using dynamic statements in ibatis, you still need to pay attention to some details. The following is an example:

Environment: Oracle, ibatis, java

Error Example 1: The symbol "<=" may affect the validity of the xml ing file.

Error Example 2: Use the entire SQL statement Tag to avoid conflicts, which is generally feasible. However, because the SQL configuration contains a dynamic statement (where part), the system cannot identify the dynamic part, the entire SQL statement is invalid.

Correct practice: narrow down the scope and only adjust the validity of the conflicting characters.

Summary:

When using CDATA, you only need to include the code that may cause conflicts. Do not blindly include the code.

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.