533 questions
0
votes
1
answer
54
views
Using Map in where clause in @Select query, giving error parameter not found
@Select("""
SELECT CURRENCY_CD,COUNTRY_CD,FEE_RATE_VAL FROM FEE
WHERE (COUNTRY_CD, CURRENCY_CD) IN
<foreach item="currencyCd" ...
0
votes
1
answer
138
views
How do I insert a blob type using Mybatis?
In my Spring Boot application using MyBatis for SQL queries I am having trouble inserting a blob type to MySQL:
Model.java
public class Model {
private Integer id;
private Blob contentblob;
public ...
0
votes
0
answers
33
views
MyBatis with Spring - @Delete annotation run multiple queries
How do I run multiple queries for a delete:
@Delete(
"""DELETE FROM punch_attachment WHERE tablename = '${tableName}' AND recordid = #{id};
DELETE FROM ...
1
vote
1
answer
29
views
MyBatis seelct query with where condition list of objects
Employee Class
Long id:
String Name;
I have list of Employee object and i need to get the details from Employee table filtered with both id and name.
I tried something like this
<resultMap type=&...
0
votes
0
answers
41
views
MyBatis With Cloud Spanner -- Is Selecting A Collection of Inner POJOs w/Single Parent Key From Single Table Possible?
Looking at the MyBatis docs for building entities which themselves contain lists of other entities, the following SHOULD work unless I'm misunderstanding (completely possible), but it results in ...
0
votes
2
answers
118
views
Postgresql - fix Cause: org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = boolean
I've got a Postgres table with an integer column and a MyBatis bean with a Boolean type.
val damaged: SqlColumn<Boolean> = column("damaged", JDBCType.TINYINT)
I have columns defined ...
0
votes
0
answers
52
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
70
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
641
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
1
answer
672
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
74
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<...
1
vote
0
answers
479
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
80
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 ...
-1
votes
1
answer
77
views
Updating List of values in MyBatis - SQLSyntaxErrorException
Getting SQLSyntaxErrorException while updating List of values in MyBatis. I am using separator=";" in forecach tag, but still I am getting the error. Below is my sql query
<update id=&...
1
vote
2
answers
2k
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
193
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
82
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
140
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
30
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
462
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
71
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
820
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
1k
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
375
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
635
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
642
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
222
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
282
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
620
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
551
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
398
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
198
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
94
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
260
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
1k
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
127
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
569
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
796
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
589
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
1k
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
30
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
963
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
3k
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
213
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
961
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
391
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
682
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" +
&...