MyBatis General Mapper Tips

Source: Internet
Author: User

First, sort error code: Example.orderby (BaseEntity.Field.GMTUpdate + "desc"); correct way: first: Through the annotation @OrderBy (value = "desc") The second is: Example.setorderbyclause ("Gmt_update DESC"); note here is the column name, not the property name.
II. handling NULL exceptions for Oracle <?xml version= "1.0" encoding= "UTF-8"? ><! DOCTYPE configurationpublic "-//mybatis.org//dtd Config 3.0//en" "Http://mybatis.org/dtd/mybatis-3-config.dtd" > <configuration><settings><setting name= "cacheenabled" value= "false"/><!--solve the error when inserting null-- ><setting name= "Jdbctypefornull" value= "NULL"/></settings></configuration>
The SelectOne return value of mapper may be null, and the resulting result should be null-determined.
Four public interface sequencemapper{@Select ("Select Seq_${tablename}.nextval from dual") int getsequence (@Param (" TableName ") String tableName);}

MyBatis General Mapper Tips

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.