Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to solve the The error may involve defaultParameterMap error in Mybatis

Shulou Source: shulou.com Published: 2022-06-02 08:00:21 10月18日 Update

This article mainly explains "how to solve The error may involve defaultParameterMap errors in Mybatis". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the The error may involve defaultParameterMap error in Mybatis.

Today, when writing a multi-conditional link query, there was a The error may involve defaultParameterMap error.

It turned out that the sql statement wrote

SELECT

D.device_unique_id,d.position_id, d.device_name,c.hardware_version

C.software_version,c.longitude,c.latitude,c.height

FROM device d

INNER JOIN # {deviceType} c

ON d.device_unique_id=c.device_unique_id

And d.project_id=# {projectId}

It is right for SQL to put this error into Navicat, but it keeps reporting this error in the program.

I know it's a parameter configuration error, but I've been looking for it for a long time. It turns out that when I passed in a parameter, I used the

# {} accepted the parameter, but the parameter is the table name, so the parameter is always wrong. Because # {} will add "" to the parameter to become a string. Later changed to ${} to accept parameters. This can be carried out.

That is, you should use ${} to accept the table name and # {} to accept other parameters.

Finally, it was changed to

SELECT

D.device_unique_id,d.position_id, d.device_name,c.hardware_version

C.software_version,c.longitude,c.latitude,c.height

FROM device d

INNER JOIN ${deviceType} c

ON d.device_unique_id=c.device_unique_id

And d.project_id=# {projectId}

You can query normally.

At this point, I believe you have a deeper understanding of "how to solve The error may involve defaultParameterMap errors in Mybatis". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Error parameter query content is in learning practical deeper interest character string practical practical simple operation method time more friends conditions programs Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Redmi MySQL NVidia OPPO Reno