sql macro tag in myBatis XML mapper.
Questions tagged [mybatis-sql]
26 questions
3
votes
3 answers
How to solve indexOutOfBounds error in MyBatis selectForUpdate?
I use postgreSQL. Here is my request in a myBatisMapper:

Maksym Rybalkin
- 453
- 1
- 8
- 22
2
votes
1 answer
Mybatis Insert PK manually
I am trying to single insert data into table with assigned PK. Manually assiging PK.
XML file
…

Surya Chandra
- 59
- 4
2
votes
2 answers
Checking property existence of include fragment in MyBatis
Is there some way to check if a property in include fragment has been set?
Example:
...
...
...
And then when this fragment is used:
…

quark
- 23
- 5
1
vote
0 answers
Can mybatis dynamic sql operate data queried from sql?
Mybatis can operate input parameters data with "if" and "foreach", but how about the data just queried within same Mybatis sql?
case:
table
field
1
select filed from table;
will get 1
Can Mybatis manage to update field to 2 with this kind of…

wo4wangle
- 99
- 6
1
vote
1 answer
MyBatis dynamically including script
I am trying to dynamically include select query based on some input parameters.
The following is what I am trying to achieve.
SELECT * from
table_1
WHERE a = #{param1}
SELECT * from
…

Sooraj
- 73
- 8
1
vote
0 answers
How to populate values to Map of a POJO in MyBatis
I have a Java class that looks like this.
class Student {
private String studeID;
private String UUID;
private Map attributes;
}
And I have SQL to get students as follows.
SELECT studeID, UUID, F_NAME, L_NAME, PHONE FROM…

Santosh Hegde
- 3,420
- 10
- 35
- 51
1
vote
1 answer
Getting Map> using MyBatis
Here is my method, I need to get a Map>:
@Mapper
public interface CMBillMapper {
@MapKey("groupId")
Map> getCMInvoicesByIdListSQL(@Param("invoiceIds") Set invoiceIds);
}
Here is MyBatis xml…

Maksym Rybalkin
- 453
- 1
- 8
- 22
1
vote
1 answer
Using Environment variables in Mybatis properties file
I am using mybatis to connect to database and i have stored some schema information in external properties file. I have kept this property file somewhere on my disk and referring it in my config.xml like below
In Config.xml

Gani
- 709
- 3
- 13
- 21
0
votes
0 answers
Using column alias in Mybatis3 Dynamic SQL
i am using Mybatis3 dynamic SQL to implement the following SQL:
select count(column1) from table1 left join (
select column11, column22, column1 from table2
where tag='OK'
) subquery
on table1.column1 = subquery.column1
it is actually to count all…

xgwang
- 614
- 7
- 21
0
votes
0 answers
Error: Caused by: java.io.FileNotFoundException: class path resource [SqlMapConfig.xml] cannot be opened because it does not exist
Background:
I'm working on apache camel project and trying to use myBatis (camel-mybatis) for DB query purposes.
But when I try to deploy the bundle in KARAF, it prompts the below…

Lakshan Thilakarathne
- 55
- 1
- 5
0
votes
0 answers
MyBatis SDO_NN inject parameter exception
I am using MyBatis with Java 8. I am trying to inject mybatis parameters into SDO_NN constructor in oracle like;
SELECT
c.COLUMNNAME_ID as columnId,
TRIM(c.COLUMNNAME_NAME) as columnName,
…

Can
- 11
- 3
0
votes
1 answer
resultMap in mybatis , I need to pass a List of Strings as return type. How to do this in the mapper file
In the above select query in my mapper file I need to get the resultMap as a List of Strings. How to implement as default Collection cannot be given directly.
I tried using…

Santhosh P
- 1
- 1
0
votes
0 answers
Is there a way to customize MyBatis auto-generated dynamic sql when java type is date and mysql is timestamp?
I use MyBatis3 Dynamic SQL (pure java generated sql without any xml mapper) in spring with mysql as db.
When I have an entity with value of Date type, MyBatis will change the value to timestamp format in generated sql query.
For example:
public…

Xing Da
- 11
- 1
0
votes
1 answer
Mybatis, pass muliple list as parametres
String loadCandies(@Param("id") String id, @Param("varietyList") List varietyList, @Param("errorCode") List errorCodes)
How can I achieve this in mybatis xml, as for a single list in parameter we can directly use foreach tag in where tag clause but…

Ankur
- 19
- 5
0
votes
1 answer
how to directly add ENUM in Mybatis IN query ,with no params
i directly have to check ENUM in where condition ,
AND
RTRIM(INTH.IF_FILETYPE) IN

Rishab
- 1
- 1