Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the differences between autoMapping and autoMappingBehavior

Shulou Source: shulou.com Published: 2022-06-02 00:49:50 10月02日 Update

This article mainly shows you "what is the difference between autoMapping and autoMappingBehavior". It is easy to understand and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "what is the difference between autoMapping and autoMappingBehavior".

The difference between autoMapping and autoMappingBehavior autoMappingBehavior

Configured in settings in the mybatis core configuration file, specifies how MyBatis should automatically map columns to fields or properties. NONE means to cancel automatic mapping; PARTIAL only automatically maps result sets that do not define a nested result set mapping. FULL automatically maps any complex result set, whether nested or not. The default is partial, which is a global setting

AutoMapping

Used in resultMap or association,collections, it is a local switch. When enabled, the attributes in the nested query are automatically set. The priority of the local switch is higher than that of all switches. When all the switches enable FULL mapping, the local switch is turned off, and the mapping still does not occur.

Examples

Configuration information. The Settings of mybatis is all the default configuration. We test the results of local automatic mapping.

SELECT id, username, jobs, phone, idCard.cardId as cardId, idcard.address as address FROM t_customer, idcard WHERE t_customer.cardId=idcard.cardId and t_customer.id=# {id}

Test result

DEBUG [main]-= > Preparing: SELECT id, username, jobs, phone, idCard.cardId as cardId, idcard.address as address FROM t_customer, idcard WHERE t_customer.cardId=idcard.cardId and tasking customer.idling?

DEBUG [main]-= > Parameters: 2 (Integer)

DEBUG [main]-Preparing: SELECT id, username, jobs, phone, idCard.cardId as cardId, idcard.address as address FROM t_customer, idcard WHERE t_customer.cardId=idcard.cardId and tasking customer.idcards?

DEBUG [main]-= > Parameters: 2 (Integer)

DEBUG [main]-Preparing: SELECT id, username, jobs, phone, idCard.cardId as cardId, idcard.address as address FROM t_customer, idcard WHERE t_customer.cardId=idcard.cardId and tasking customer.idcards?

DEBUG [main]-= > Parameters: 2 (Integer)

DEBUG [main]-

Tags: Configuration properties results local query priority global content alias at the same time article test same function prefix field situation manual method Li Si Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Redmi OPPO Reno Shulou Information Microsoft