531 questions
0
votes
0
answers
34
views
mybatis springboot data copy from 1 databse server to another
Using mybatis batch session template to copy data from a table having millions of records to another table in another oracle server.
@Bean(value = "batchSqlSession")
@Autowired
public ...
0
votes
0
answers
33
views
MyBatis - Issue while passing parameter object to the query
I have a Spring application with MyBatis.
Facing an issue while passing parameter object. It works fine if I hardcode the values in query. It doesn't return anything also no error when I pass the ...
0
votes
0
answers
62
views
Getting java.sql.SQLException from DB but it is not execution catch block created for it However it is executing the catch created for Exception
I am trying to insert a record in DB and in one scenario it is throwing
java.sql.SQLException(### Error updating database. Cause: java.sql.SQLException: ORA-12899: value too large for column "...
0
votes
1
answer
290
views
Class org.apache.commons.pool2.impl.BaseObjectPoolConfig does not have member field 'java.time.Duration DEFAULT_DURATION_BETWEEN_EVICTION_RUNS
I'm trying to run a Java 21 app with Spring boot 2.7.18 and mybatis 3.5.10. The project compiles fine but I get the exception below when i run it. The DEFAULT_DURATION_BETWEEN_EVICTION_RUNS ...
0
votes
0
answers
45
views
MyBatis Syntax error for xml SQL queries for delete operartion
My MyBatis XML looksl like this
<delete id="deleteAllById" parameterType="java.util.List">
DELETE FROM `user`
WHERE id IN
<foreach collection="list" ...
0
votes
0
answers
637
views
Resolving Compatibility Issue: Integrating MyBatis with Spring Boot 3.3.0-Snapshot and Java 17
Encountering a compatibility hurdle while integrating MyBatis with Spring Boot 3.3.0-Snapshot. My attempt to include the MyBatis dependency resulted in a requirement stating it needs Spring Boot ...
0
votes
1
answer
377
views
Can we use mybatis <foreach> in UPDATE statement with mysql
I'm trying to run multiple update statements in my Spring Boot application that is calling MySQL db using MyBatis. XML configured query looks like this:
<update id="updateAnglersTrackPositions&...
0
votes
1
answer
61
views
Mybatis kotlin dynamic sql update to newest 1.5.0 trouble with isIn
I'm converting a couple of pieces of code to the newest mybatis dynamic sql, and this line is giving me fits:
** Old Code - won't compile with newest version **
fencingSupportMapper.select { where<...
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'...
1
vote
0
answers
215
views
Why can't I correctly use ibatis
I already induct the dependency of Mybatis, in way of pom. The part of the pom be like:
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId&...
0
votes
0
answers
44
views
How to enable transaction logging in a Springboot&MyBatis project?
I'm studying transaction propagation and would like the console to print logs related to transactions.
Is there a simple solution for achieving transaction logging in a Spring Boot and MyBatis project?...
0
votes
0
answers
65
views
Return value of forech statement in mybatis
As follows, I wrote a query to update multiple rows using the foreach statement.
<update id="deleteVhcleInfos" parameterType="java.util.List">
<foreach ...
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
@...
0
votes
0
answers
71
views
@MockBean not working for mybatis repositories after upgrading spring boot version from 2.1 to 2.3
@MockBean is not working for mybatis repositories after upgrading the spring boot version from 2.1 to 2.3. While running the UT, it calls the actual method instead of the mocked method, hence my unit ...
0
votes
0
answers
121
views
How can I avoid Mybatis reloading configuration for every `SqlSessionTemplate`?
Recently I noticed that my project takes quite a long time initializing Mybatis-related beans and classes. My database has tens of shards and there is a wrapper that routes queries to the shards. ...
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 ...
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
...
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
0
answers
281
views
how to use mybatis collection property when tables don't have direct relationship?
i have the following data (which were simplified for the purpose of this question):
t1
pk | a | b | c | other1
1 | text1 | 123 | text3 | otherValues1
2 | text2 | 456 | text4 | otherValues2
...
0
votes
0
answers
536
views
Mybatis query execution is too slow
I created a project with eclipse maven.
And I use Spring Boot 2.2.2 Release and mybatis-spring-boot-starter 2.1.0, Postgresql 13.
It's built as a monolithic application, running over 50 insert queries ...
0
votes
0
answers
564
views
How to set global custom property in MyBatis with Spring configuration
It like to be able to set custom properties in MyBatis java config that I can reference later in my XML mappers. I've created a config class that sets two beans:
@Bean
public DataSource ...
0
votes
1
answer
190
views
How can I log database errors at ERROR level when using Camel and MyBatis in my Spring Boot app?
I have an app built on Java, Spring Boot, Apache Camel, MyBatis, Oracle. It used the Java DSL approach to configuration.
Many of the routes poll the database for data:
@Component
public class ...
0
votes
1
answer
238
views
how to wrap a boolean oracle function on a java integer using mybatis?
so this is pack_name.func_name working at sql developer:
using spring and mybatis, i have the issue to deal with oracle's BOOLEAN type with an old jdbc driver that i cannot update. trying this idea, ...
1
vote
0
answers
563
views
Mybatis upgrade issues related to parameters
I was trying to upgrade my spring version from 4 to 5.3.23
Also updated Jackson databind to 2.13.5
While doing so I needed to upgrade mybatis from 3.0 to 3.5.11
Also mybatis-spring from 1.0 to 2.1.0
...
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
2
answers
401
views
Spring boot @Transactional does not work when org.springframework.http.converter.HttpMessageConversionException is thrown?
I have a rest controller, it will insert 1 record per request,like:
@Transactional(rollbackFor = Exception.class)
@PostMapping("/create_user")
public Response<Empty> createUser(@...
0
votes
0
answers
321
views
Choose schema name dynamically in mybatis xml based on request attribute
How to dynamically pick the schema name based on a request in my batis schema?
We would like to do this without changing the arguments or definitions of Mapper files or with parameterType as this ...
0
votes
1
answer
186
views
Can't I use Mybatis' resultMap's association and collection together?
The team table and the schdule table are in a 1:n relationship.
I made a select query showing the reservation details of team as below.
<select id="getTeamSchdules" resultMap="...
0
votes
1
answer
88
views
does these 2 ways of querying equivalent?
I'm a Spring backend learner, currently want to query some data from mysql. What I want is just a field from table.(I want categoryName in category).
First, I was using LambdaQueryWrapper. I wrote
...
1
vote
1
answer
209
views
Spring & MyBatis - how to get MyBatis databseId in a @Bean annotated function
I am trying to create a Spring bean based on a MyBatis databaseId like so:
@Bean
fun getSomeBean(@Autowired databaseId: String): SomeBean {
if(databaseId.equals("mysql")){
return ...
1
vote
0
answers
935
views
Type handler implementation for array of objects in myBatis
I am trying to write type handler for array of objects but this is giving me errors. I want to store arraylist as JSON in DB(mysql) and retrieve it as arraylist . I got the type handler examples with ...
0
votes
1
answer
119
views
Im Trying to log queries , doesnt matter if they're unprepared ones , for over 500 xml mapper files using jdk logger . (mybatis - spring )
previously when I used to used ibatis , it was running fine just by adding java.sql to my logs.properties file in tomcat and that used to output the queries with their params to the log file .
now ...
0
votes
1
answer
472
views
How to compare MySQL binary UUID using dynamic SQL in Mybatis
We store one of the UUID values as binary(16) in mysql db.
spec
MyTable myTable = new MyTable();` //table
SqlColumn<Long> id = column("id");` // id column
SqlColumn<UUID> ...
0
votes
0
answers
739
views
sqlBuilder pagination with MyBatis without Limit & Offset in the query
I'm trying to understand how to do dynamic queries for pagination with myBatis in my java spring-boot application
My problem is that the database version of my application is Oracle 11.2 which doesn't ...
0
votes
0
answers
530
views
Mocking Mybatis Mapper Not working in Spring boot integration tests
I am trying to mock my batis mapper.
@SpringBootTest(classes = ApiApplication.class, webEnvironment = WebEnvironment.DEFINED_PORT)
@AutoConfigureMockMvc
@TestPropertySource("classpath:test-...
0
votes
1
answer
814
views
Why mybatis default ExecutorType is Simple not Batch?
Why mybatis default ExecutorType is Simple not Batch ? Batch is more effective than Simple . Why use Simple as default ExecutorType ?
-1
votes
1
answer
28
views
mysql query date erro
Why is the difference between the time of the database query and the result 13 hours?
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
1k
views
java.lang.IndexOutOfBoundsException: Index 16 out of bounds for length 10 Error
I encountered the following error during the posting paging process. I don't even use an array, but I don't know why I get this error. How can I solve this?
BoardCriteria is an object that stores the ...
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
180
views
MyBatis mapping nest pojo of fundamental type
I have a POJO of type:
POJO {
int id;
int name;
List<Date> Dates;
}
Now my POJO is broken into two tables x and y, where y have dates and x have name, which are joined over the id as below:
...
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
368
views
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 ...
1
vote
2
answers
616
views
Java MyBatis How to find SUM of the Cases WHEN value is IN the list passing the list as a parameter to the mapper's method
In my Mapper Class I have a method with the example query:
"<script>......"
“GROUP BY acct, call, score HAVING sum(case when code in(\n" +
"'PTP' \n" +
&...
1
vote
1
answer
446
views
Is it possible to use yaml's profile variable in spring mybatis's mapper xml?
It is possible to use yaml's profile variable in spring mybatis's mapper xml?
If is it possible, how i can use?
0
votes
0
answers
1k
views
How can I execute a method inside mybatis mapper?
<if test="group_id != null">
<choose>
<when test='group_id.get("eq") != null'>
and roleobj.object_id = ${group_id....