Questions tagged [mybatis]

MyBatis is a framework for mapping objects to relational databases with an emphasis on high performance and simplicity. XML descriptors or annotations couple the objects to SQL statements or stored procedures.

Filter by
Sorted by
Tagged with
0 votes
0 answers
8 views

Spring Cloud Sleuth with Mybatis

I have project using Mybatis to connect Database Recently i apply spring-cloud-starter-sleuth for my project to tracing log But when logger from Mybatis show log it lost traceId and spanId like bellow ...
Giang Dương's user avatar
0 votes
0 answers
31 views

About how to specify which one to call after overloading the set method of an entity class

I defined a dto, it has a field which is a list of permissions, and I used a multi-table association to query it out as a string separated by ',' which I want to automatically convert to a list when I ...
user22457778's user avatar
1 vote
1 answer
24 views

MyBatis yielding Java records

I am moving from Java Pojo's to Java records using MyBatis. Is it possible in MyBatis to create a Java record which has a field of type collection? How should the resultMap be defined?
Mark Smith's user avatar
0 votes
0 answers
37 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 ...
Sandeep Kumar P K's user avatar
0 votes
1 answer
24 views

Why the mybatis's MetaObject Class not support the path like "[0]"?

I'm reading the mybatis code,than I found that MetaObject is a very important class. We use it to access the property(even the nested property) of Object. If we have a Object like this: { "a&...
vate's user avatar
  • 1
0 votes
1 answer
50 views

Using MyBatis mapper.xml to increment a multiple counters in the same query inside of a JSONB field in Postgresql

I am working with Java + Spring + MyBatis + Postgresql. I have a table with a JSONB column in which there are a series of BIGINT (which are mapped to Long in Java), that for performance reason I want ...
m4mmt's user avatar
  • 33
-1 votes
0 answers
38 views

mybatis use include,param parse failed

I'm using mybatis 3.5.6,i want use sql to extract my data_permission sql,like this, <select id="listByPermission" resultType="com.lvyou.micro.domain.entity.guide.GuideDO">...
zhili's user avatar
  • 1
0 votes
0 answers
23 views

Error creating bean with name 'imageService' defined in file

this is my problems problem childProblem and this's project structure project structure I have tried many methods, but it doesn’t seem to be the main problem. I don’t know if it’s because I missed ...
luvsm's user avatar
  • 1
0 votes
0 answers
28 views

MyBatis 3.5.6: Why isn't the IPage Interface Result Considered Too Many?

I am using com.baomidou.mybatisplus.core.mapper.BaseMapper#selectPage, but MyBatis considers that it returns too many results. E selectPage(E page, @Param(Constants.WRAPPER) Wrapper queryWrapper); ...
zijain zeng's user avatar
0 votes
0 answers
45 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. ...
rooot's user avatar
  • 103
0 votes
0 answers
41 views

Why put 'like '${}%' after other conditions will cause PersistenceException?

When i try to search for data which meet the requirements including marketCode, type, is_deleted and zipcode if it exists in condition. If i use the following statement, it will cause a exception. ...
April_hyq's user avatar
0 votes
1 answer
42 views

How can I skip query if clause is null in MyBatis?

The results of select query appear as below. The total column will contain the sum of each row. day_1 day_2 day_3 total [NULL] 6 [NULL] 6 [NULL] [NULL] [NULL] 0 To find the total value, I used the ...
mentha's user avatar
  • 29
0 votes
1 answer
75 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" ...
Rajeev's user avatar
  • 444
-1 votes
1 answer
81 views

Has the configuration of the new version of mybatis changed? What should I do to fill in the time

I need a mybatis plugin to fill in the time. Previously, I only needed to obtain one parameter and change it. Now, I have upgraded the version of mybatis using<org. mybatis. spring. boot org. ...
courage's user avatar
0 votes
0 answers
43 views

Cannot delete a record using Mybatis

When conditions map contains a null value, record is not deleted. map -> NAME:"Alise" - record deleted map -> NAME:null - record not deleted @Delete("<script>" + ...
Lilia Baluk's user avatar
2 votes
0 answers
58 views

I encountered a problem in the process of integrating mybatis in using SpringBoot2

This is my error message when I start the project Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2023-10-05T18:47:51.471+08:...
yzd11's user avatar
  • 21
0 votes
0 answers
21 views

No values ​are entered into Mybatis SQL in Spring project

I'm working on a spring project with IntelliJ. My DAO // Board Insert public int boardInsert(String rb_uid, String rb_sub, String r_name, String r_address, String rb_contents, int rb_rating) { ...
SectionPJY's user avatar
1 vote
0 answers
25 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 ...
Inked's user avatar
  • 23
0 votes
0 answers
84 views

mybatis list foreach is null

I've already determined in the java code that the list is not empty before executing the sql, but occasionally there are sql's here that are wrong. Sometimes the production sql is select name from ...
senz's user avatar
  • 79
2 votes
2 answers
93 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 ...
footlessbird's user avatar
0 votes
0 answers
55 views

Is there a way to use mybatis compatible with jakarta?

I currently have a project that depends on Google Guice (5.1.0) and org.mybatis:mybatis:3.5.13 Now I have to update Google Guice to 7.0.0 which uses jakarta instead of javax. That, though, makes it ...
Sergey Stepin's user avatar
0 votes
0 answers
72 views

Excluding AutoConfigureTestDatabase from MybatisTest not working

I'm trying to configure a Spring Boot application that uses MyBatis in order to run the tests for the mappers. I see there is a MybatisTest annotation that may be useful...but it does autoconfigure an ...
x80486's user avatar
  • 6,765
0 votes
0 answers
76 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 ...
farmerbenny's user avatar
0 votes
0 answers
21 views

unable to inject multiple datasources into jersey

Hi Im tring to inject multiple datasources into jersey using mybatis. ` class app extends RestApplication<config> { MyBatisBundle mybatis=new MyBatisBundle(); public void ...
nik's user avatar
  • 19
0 votes
1 answer
75 views

H2 database can not find lowercase table name?

I got an error when updating h2 data from spring + mybatis, the table "ADDRESS" can not be found. But the table name in my sql is "address", as the error message itself said. What ...
Jason's user avatar
  • 546
0 votes
1 answer
44 views

What is the default datasource type for mybatis?

I'm a beginner when it comes to mybatis, and I have a question I've been trying to research as well. If for instance, the datasource type tag wasn't declared in any configuration xml, is there like a ...
Uzi's user avatar
  • 453
0 votes
0 answers
28 views

How to obtain the self increasing ID of batch inserted data without passing parameters?

environment mybatis 3.4.6 Target class org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator.class Question Obtain the self-increasing ID of the Batch Insert data, which will be set to the elements of ...
Jin Zhang's user avatar
1 vote
2 answers
130 views

Is @Transactional necessary for multiple query operations in one method using MyBatis?

I'm currently working with MyBatis and I have a method where I perform multiple query operations. For example, in my UserService class, I have a method getUserOrders(String username) where I first ...
voi's user avatar
  • 13
1 vote
1 answer
131 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 = ...
Abhishek Acharya's user avatar
0 votes
1 answer
164 views

While using Spring Batch, I encounter the SQLTransientConnectionException: Connection reset error

While using Spring Batch, I encounter the SQLTransientConnectionException: Connection reset error. The corresponding log is as follows: Caused by: org.apache.ibatis.exceptions.PersistenceException: ###...
pyoun's user avatar
  • 3
0 votes
1 answer
76 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 ...
Holger Veltrup's user avatar
0 votes
0 answers
71 views

Mybatis @MapperScan wildcard package path usage problem

I used Mybatis-plus + Kotlin + Springboot, my configuration is as follows: @Configuration @MapperScan("com.sage.**.mapper", "com.sage.**.mapper.xml") class MybatisPlusConfig I ...
SageJustus's user avatar
0 votes
0 answers
519 views

Error attempting to get column ''0'' from result set. Cause: java.sql.SQLException: Column ''0'' not found

Question? how can i support this feature like: <collection property="approvalDomainList" ofType="com.icss.ebu.spms.asset.api.model.ApprovalDomain" column=&...
jiangfengwei's user avatar
0 votes
0 answers
38 views

MyBatis Collection Mapping Issue Based on Column Order

I am having an issue when creating a collection of columns from multiple rows based on a specific id using MyBatis. Here's the problematic MyBatis code: <resultMap id="testMap" type="...
Sanggi Son's user avatar
0 votes
0 answers
66 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 ...
rado's user avatar
  • 5,950
0 votes
0 answers
35 views

MyBatis foreach with reference to enclosing object

I have a Java object with a property which is a collection. I'm using this collection in a MyBatis foreach loop. In this loop I want to use a property of the parent object: <foreach collection=&...
Mark Smith's user avatar
1 vote
1 answer
122 views

Mybatis static method for object creation

I have a class with a private constructor and a public static factory method: public class Car { private final String name; private final boolean isCheap; private Car(String name, boolean ...
Vadim's user avatar
  • 594
0 votes
0 answers
29 views

Is there an neovim plugin for mybatis?

1.recently code java in neovim. But i can not find a mybatis plugin in neovim. 2.need a neovim plugin when i code in mybatis xml files(just like myabtis plugin in other ides. eg:idea). 3.easy jump ...
wuhelang's user avatar
0 votes
0 answers
37 views

Using SpringBoot2.7 and MyBatis 2.3 How can I code a cleaner request class structure?

First of all I apologize for my poor English skills. So far, when designing a class that receives a request from a form, I have created each class separately. This time, unlike before, we are trying ...
DogFe's user avatar
  • 1
0 votes
0 answers
138 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 ...
Hyeonjun Jeong's user avatar
0 votes
0 answers
50 views

How to share a object between two Mybatis interceptors?

I want to set value to a custom object in the first interceptor @Intercepts( { @Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class}), ...
gryphon's user avatar
0 votes
0 answers
15 views

BaseJdbcLogger queryStack multi thread not safe

i have opend sql debug log by adding: logging.level.com.***.mapper=debug then two thread in one request execute query separately by: Mono.zip(selectA(session),selectB(session)).flatMap(insertC(session)...
hal hu's user avatar
  • 1
0 votes
1 answer
115 views

SQL state [99999]; error code [17068] nested exception is java.sql.SQLException:

I'm trying to call a stored procedure from my java application using myBatis. My db type: create or replace TYPE ARR_TEXT_OUT AS VARRAY(20000) OF VARCHAR(200); My stored procedure (I think you only ...
Emmanuele Guerriero's user avatar
0 votes
0 answers
41 views

Mybatis override mapper XML in submodule

I am using Spring Boot with mybatis. I have one common module that defines @Repository Mapper and appropriate .XML document for the mapper. In other module, that uses common module I want sligtly ...
Artyom Danilin's user avatar
0 votes
0 answers
40 views

How does the @Results annotation of mybatis implement one-to-many mapping (do not use @one, @many annotations)

How does the @Results annotation of mybatis implement one-to-many mapping (do not use @one, @many annotations. Because they will generate multiple sql statements). I can do one-to-one result set ...
1515biubiubiu's user avatar
0 votes
0 answers
107 views

Could not create connection to database server' Attempted reconnect 3 times Giving up

I configured multiple data sources and started running normally. After two hours of not operating the database, I performed an insert operation and encountered a 'Could not create connection to ...
Hang Mao's user avatar
0 votes
0 answers
98 views

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 ...
xgwang's user avatar
  • 614
0 votes
1 answer
114 views

MyBatis when test without @Param

My problem. I got this Mapper List<NotificationEmail> getAllErrorNotifications(); and this is part of my Mapper xml <select id = "getAllErrorNotifications" resultMap = "...
LiefLayer's user avatar
  • 987
0 votes
0 answers
22 views

The format-trans problem in using Redis as the second-level caches of MyBatis in spring project

There is one sql in my mapper: @Select("select count(*) from passages where area = #{area}") public int searchOilInfo(@Param("area") StringBuilder area); I executed this: int res =...
Da_PenGu's user avatar
0 votes
0 answers
67 views

Is there a way to modify session varaibles in mybatis?

For example, the MySQL group_concat function will truncate at 1024 characters, and I want to change it to a bigger size. Where can I set SET SESSION group_concat_max_len=2048 when using mybatis? I ...
puppylpg's user avatar
  • 956

1
2 3 4 5
69