72 questions
0
votes
0
answers
88
views
MyBatis Mapping Xml Issue
I was writing this project and I have this problem about the mapping. I am doing something wrong but I cannot find it. I've also checked the document of MyBatis but I couldn't find any update info.
I'...
0
votes
0
answers
79
views
mybatis-dynamic-sql, when using groupBy, where{} OR having{} will be wrong
Here is the one i'm using: https://github.com/mybatis/mybatis-dynamic-sql/tree/master
I've been stuck here for quite a while and don't know why. When using groupBy and ‘where OR having’ has a filter,...
0
votes
2
answers
1k
views
mybatis resultMapping not working when order of field names are changed
I am storing playlist information in an SQLite database. This is my entity class;
@Data
@Builder
public class Playlist {
private String id;
private String playlistName;
private ...
0
votes
1
answer
94
views
Failed to map to class with member objects when used with Lombok
The Task class has an instance of TaskPayload as a member object.
@Data
@Builder
public class Task {
private int id;
private TaskPayload payload;
// skipping other members
}
@Data
@...
2
votes
1
answer
345
views
MyBatis error converting result into Java records with an association
We are moving from using Java Pojo's as DTO's to records with the MyBatis framework.
The following two record types are used:
public record User(Integer cprid, String inlognaam, String upn, Boolean ...
0
votes
0
answers
29
views
MyBatis update annotation failed - ORACLE ERROR ORA-00933 [duplicate]
In a classic spring boot application I've this query in Mapper
@Update("UPDATE MY_TABLE SET STATUS_CODE=#{status} WHERE ID_DOC=#{idDoc};")
void updateStatus(@Param("status") final ...
0
votes
1
answer
336
views
What is resultType for bytea column of postgres while retrieving using mbatis mapper?
I have a query which returns data from bytea column from postgres.
The data type used at java side is byte[]
The query in mybatis mapper is like below :
<select id="getPhoto" ...
1
vote
0
answers
59
views
Mybatis - nested lazy loaded result property is already exist on result map issue
I’m plan to upgrade the spring from 4 to 5
Due to which I need to upgrade mybatis from 2 to 3.5.11
While upgrading mybatis , I’m facing this issue which is something unclear to me.
I’m getting below ...
1
vote
1
answer
464
views
How to solve "has an unsupported return type: class java.lang.String" when using Mybatis insert
in my project i need to use pk just i insert.
so i used selectKey in my xml and it returns error : has an unsupported return type: class java.lang.String
i am using Spring, Java1.8, Oracle DB
and my ...
2
votes
2
answers
632
views
MyBatis xml update query using set tag throws org.springframework.jdbc.BadSqlGrammarException
Built update query in MyBatis xml but no luck to pass BadSqlGrammarException
Here's my query
<update id="updateRecordingVideoStatus">
UPDATE
...
1
vote
0
answers
162
views
MyBatis TypeException when using <foreach>
I'm trying to create a SelectStatement in Mybatis 3.5.13 using a foreach iterating over a map, where the keys are Column Names and the values are the value I want to select on.
I've confirmed that all ...
0
votes
1
answer
794
views
How to use conditional where clauses with Mybatis using annotations?
My service is as follows,
public List<ApplicationConfig> find(@RequestBody String type){
List<WhereClauseParams> conditions = new ArrayList<>();
WhereClauseParams condition = ...
0
votes
1
answer
162
views
How to read nested optional object for an insert statement?
How to read nested optional object for an insert statement?
I have the following classes;
public class MyObj {
private String myField;
private MyChildObj myChild;
public (String ...
0
votes
0
answers
163
views
How can I map two different cursor from stored procedure with config xml only using Mybatis
Author (Cursor 1 Data)
ID
NAME
PUBLISH_ID
1
John
123
2
Jane
345
Book (Cursor 2 Data)
PUBLISH_ID
BOOK_ID
BOOK_NAME
123
B101
C#
123
B102
Python
345
J001
SQL
345
J002
JAVA
Class Author {
...
0
votes
2
answers
63
views
Using if statement to select table inside FROM statement in ORACLE
please someone help me.
I want to convert this query from mybatis to ORACLE
SELECT *
FROM TABLE_A
<if paramA is not null>
, ( SELECT *
FROM TABLE_B
) B
</if>
...
0
votes
1
answer
3k
views
MyBatis update returning a list of values
I have the following update query in my mybatis xml:
<update id="updateRoleValues" parameterType="map">
UPDATE sandbox.roles
SET rolename = #{roleName},
...
0
votes
1
answer
248
views
Querying multiple records using composite key in the mybatis
I have a table with composite key. I want to query it in bulk in mybatis. Is it possible? if yes, how?
Table structure of table Foo with foo_id_1 and foo_id_2 as composite primary key.
{
foo_id_1 ...
0
votes
0
answers
892
views
Problem of org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
Here's my problem. I was trying to learn about mybatis in springboot. It can connect to JDBC correctly. However it keeps throwing Invalid bound statement (not found). And I cannot find the bug.
pom....
0
votes
0
answers
249
views
How to compare dates with less than operator in mybatis XML in <if test = " "> block
<if test= "birthdate lt '20-10-2000'">
it works but is there a better way which mybatis documentation approves?
0
votes
0
answers
861
views
Error querying database. cannot invoke "Object.hashCode()" because "key" is null
I'm getting the following error
Error Querying database. cannot invoke "Object.hashCode()" because "key" is null
stack trace:
org.mybatis.spring.MyBatisSyste Exception: ...
0
votes
0
answers
116
views
Add a Mapper to cache with java api
I want to add a Mapper to cache with java api in MyBatis. I try this way and add Mapper's namespace to caches, but the statements of the Mapper still has no cache. is there any way to add Mapper ...
0
votes
3
answers
306
views
mybatis mapper on node express xml regular expression error
when I open the web page via node express + mybatis-mapper,
it works on dev environment on my PC(windows + vscode).
But it not works on linux(ubuntu) server with below error message.
It seems like xml ...
0
votes
1
answer
704
views
resultMap in mybatis , I need to pass a List of Strings as return type. How to do this in the mapper file
<select id="getXXX" parameterType="java.util.List" resultMap="?">
</select>
In the above select query in my mapper file I need to get the resultMap as a List ...
1
vote
0
answers
90
views
how can i solve mapper null pointer error in dao with spring
[First, I was built bean for mapper interface and dao in Dispatcher Servlet.xml .Then I built the new package for mapper then add interface and i built dao too.In dao, i built service from dao bean in ...
0
votes
1
answer
2k
views
Overriding mybatis typehandler
Im using latest spring boot with spring mybatis which uses mybatis 3.5.9
I have a pojo with a LocalDateTime and the db has a timestamp.. So I would expect mybatis to convert it.. But since, 3.4.1 ...
0
votes
1
answer
824
views
UUID insert fails when using a UUIDTypeHandler
I'm trying to insert a UUID value, into a Postgresql table, so I've defined and configured a UUIDTypeHandler to deal with this at mybatis level.
Unfortunately, the insert operations are failing with ...
0
votes
1
answer
422
views
Unable to find class in mapper.xml using mybatis plus and spring boot
Unable to find class while parsing mapper.xml in mybatis plus.
Having json response class with below structure.
@Data
@Builder
@Setter
@Getter
public class StudentCourseDetailsRes {
@Valid
@...
0
votes
0
answers
2k
views
spring mybatis - Failed to parse mapping resource
I made a boardContentMap in clubMapper.xml, but I don't know why they can't find it.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined ...
0
votes
1
answer
819
views
Getting error while iterating Map in mybatis
Getting this error while iterating over Map in mybatis
Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_key_0', mode=IN, javaType=...
0
votes
1
answer
337
views
how to directly add ENUM in Mybatis IN query ,with no params
i directly have to check ENUM in where condition ,
<if test="params.fileTypes != null and !params.fileTypes.isEmpty()">
AND
RTRIM(INTH.IF_FILETYPE) IN
<...
-1
votes
1
answer
553
views
Equals() returns false on 'Y' but returns true on 'Yes'
I'm doing an if statement in mybatis, and <if test="param.equals('Y')"> returns false even when the param is "Y", but <if test="param.equals('Yes')"> returns ...
0
votes
1
answer
666
views
MyBatis - how to define array in mybatis xml mapper file
I would like to define array of string in mybatis mapper and pass it as argument for java static method.
It's possible?
0
votes
1
answer
511
views
Has MyBatis ever been able to cast java Calendar?
Two days ago I wrote this piece of program to access database, and it's been running fine. It contains some actions about searching datas with TIME as a parameter. In db, which in my case, pgsql, it's ...
1
vote
0
answers
506
views
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<String,Object> attributes;
}
And I have SQL to get students as ...
0
votes
1
answer
189
views
Insert data in 2 tables MyBatis Error Command not properly ended
I´m trying to insert data in 2 tables, I have mybatis method with 2 single inserts but when I execute it it throws:
Error updating database. Cause: java.sql.SQLSyntaxErrorException: ORA-00933: SQL ...
0
votes
1
answer
445
views
Spring My-batis MapperScannerConfigurer not resolving dat source place holder values
After adding MapperScannerConfigurer bean configuration to the configuration xml to autowire my-batis mappers, getting below datasource bean creation error for placeholder issue. looks like spring ...
0
votes
0
answers
1k
views
spring mybatis how to determine if using batch mode correctly
How do determine if one is using batch mode correctly? I am using spring boot with mybatis (org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.0)
Setup
// Controller
@PutMapping("/{id}")...
0
votes
0
answers
777
views
mybatis passing in the datatype on dynamic update query
I am trying to create a dynamic update statement using dynamic-sql method and sql-builder method but I only manage it get it work for string datatype. I'm not exactly sure how to "cast" to ...
1
vote
0
answers
894
views
Typehandler with mybatis annotations
i have a question about mybatis annotations and Oracle stored procedure
i have this in my mapper.xml:
<mapper namespace="xyzname">
...
<select id="getDocument" ...
0
votes
0
answers
2k
views
mybatis cursor "A Cursor is already closed." error msg although transactional is defined
Mapper:
@SelectProvider(type = Provider.class, method = "retrieveTx")
@Results(value = {
@Result(property = "transactionId", column = "transaction_id",...
-1
votes
1
answer
142
views
Mybatis property mapper error for List of objects in pojo class : spring Boot/mybatis
Please help : Issue description in below image URL, Issue description in below image URL, even setting property to cost/margin/retail or currentday also not working in mapper interface, Let me know,...
0
votes
1
answer
1k
views
Mybatis returningHashMap
I am new to MyBatis. Could anyone help me to resolve this. Thank you.
I created a table named "CodeValue" with columns like "Code","Value" etc. I am retrieving the ...
0
votes
1
answer
556
views
is there any way to force mybatis to use setter
I need to do some logic before the value is set from the db with mybatis,
however, my list field always has size=0
i really need help, if someone knows please help me,
I'm so appreciative
1
vote
2
answers
2k
views
How to insert java HashMap keys and values as columns in database using mybatis
I am following a SpringBoot + MyBatis tutorial.I am able to insert simple objects into the database. Eg I tried inserting an employee object:
Employee{
private String id;
private String name;
}...
0
votes
1
answer
853
views
MyBatis Typehandler with String Substitution Instead of Prepared Statement
Does MyBatis support specifying type handlers with string substitution ${} instead of prepared statement substitution #{}?
I am trying to populate an order by clause with an enum value so I am ...
0
votes
0
answers
656
views
How to generalize similar namespaces of mappers in MyBatis?
There is an XML mapping associated with an interface FirstMapper:
<mapper namespace="my.very.long.path.to.package.with.mappers.FirstMapper">
<select id="selectAll" ...
0
votes
1
answer
811
views
MyBatis mapping collection inside association
I have a next resultMap
<resultMap id="resultMap" type="***.PreMigrationData"
autoMapping="true">
...
<association property="...
2
votes
1
answer
703
views
Mybatis Insert PK manually
I am trying to single insert data into table with assigned PK. Manually assiging PK.
XML file
<insert id = "insertStd" parameterType = "com.org.springboot.dao.StudentEntity" ...
1
vote
0
answers
197
views
How can I propagate properties into a nested sql fragment?
I have an sql looks like this.
<sql name="level1">
${alias}some AS ${prefix}some
</sql>
Now I want to nest above fragment into another fragment while propagating those two ...
1
vote
3
answers
3k
views
How to map JSON_ARRAYAGG results with mybatis
I can't map the results from JSON_ARRAYAGG function.
mybatis mapper:
<mapper namespace="com.test.mapper.UserEntityMapper">
<resultMap id="userMap" type="UserVO&...