Questions tagged [spring-mybatis]

527 questions
14
votes
5 answers

Spring-boot with spring-mybatis - how to force it to logging all SQL queries

I have a simple spring-boot-mybatis app (keep in mind, please). Mybatis is logging SQL queries only in case of failure (on excepions). Tell me please, how to force it to log all SQL query to console ? At this moment I am using slf4j logger …
user6023611
12
votes
5 answers

MyBatis - jdbcTypeForNull Oracle

I am using MyBatis with an Oracle 11g R2 database. I am using MyBatis 3.3 with ojdbc6 12.1.0.2. My issue is whenever I tried to insert an object that is null I get the following. org.springframework.jdbc.UncategorizedSQLException: Error setting…
greyfox
  • 6,426
  • 23
  • 68
  • 114
11
votes
9 answers

MyBatis - Mapped Statements collection already contains value for

I had the following error messages thrown when registering the mapper classes on my server startup, [artifact:mvn] 2016-05-07 11:39:21,708 [ERROR] org.mybatis.spring.mapper.MapperFactoryBean - Error while adding the mapper 'interface…
Lucky
  • 16,787
  • 19
  • 117
  • 151
10
votes
1 answer

generating sql queries from mybatis xml queries

I have a mybatis mapper file xml with complex queries lot of where clauses with conditions. Is there any way I can create possible queries combination? I want to run explain on all these queries as I am planning to add NOT IN on all queries.
VedantK
  • 9,728
  • 7
  • 66
  • 71
10
votes
3 answers

Spring Service @Transactional doesn't rollback transaction Mybatis SqlSession

The goal is to rollback all/any transactions in case of failure. But this doesn't work as expected. We use Spring MVC + JMS + Service + Mybatis. In the logs, the JMS is set to rollback, but the row is inserted and not rollback. Would like to know…
Harry
  • 546
  • 6
  • 22
  • 50
8
votes
2 answers

TransactionManagementType.CONTAINER vs TransactionManagementType.BEAN

what is the difference between TransactionManagementType.CONTAINER and TransactionManagementType.BEAN as Im using TransactionManagementType.CONTAINER in all of my EJBs and when ever the multiple instances of database is used, It throws an error…
8
votes
2 answers

Why must the interface and xml mapper file be in same package and have the same name?

Today I was preparing an example using Spring Boot and using MyBatis for the data access communication next to Spring-MyBatis. Here is the relevant project configuration (using maven): src/main/java - edu.home.ltmj.controller +…
Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
7
votes
1 answer

MyBatis how can I generate different sql for different database backend

I'm using mybatis-spring 1.2.3 together with Spring4 to create a web application. The main data storage is MySQL in production environment, but I also use in-memory database H2 in unit testing. MyBatis works well with both of MySQL and H2 in testing…
dyng
  • 2,854
  • 21
  • 24
7
votes
1 answer

MyBatis - How to write statement under ?

I loop a collection, and only when the item of the collection is not null, then it will be inserted into the DB, the snippet code like that: (#{id}) …
Rocky Hu
  • 1,326
  • 4
  • 17
  • 32
6
votes
1 answer

MockBean and MyBatis Mapper not working together (as they did before Spring Boot 2.2.7)

I am using MyBatis Spring Boot Starter version 2.1.3. Ever since moving to Spring Boot 2.2.7 (I've also tried 2.2.8 and 2.3.1 with the same results), I've had a problem using the MockBean annotation to mock a MyBatis interface (e.g. DAO). Let's…
David Diehl
  • 225
  • 1
  • 3
  • 11
6
votes
1 answer

How is spring-data-jdbc complimenting MyBatis?

I would like to understand why is spring-data-jdbc providing integration to MyBatis. What problem is it solving? How is spring-data-jdbc complimenting MyBatis. Is it just a question of conforming the Mapper to Repository or it goes beyond that.…
6
votes
4 answers

Spring with MyBatis: expected single matching bean but found 2

I've been using Spring with MyBatis and it's been working really well for a single database. I ran into difficulties when trying to add another database (see reproducible example on Github). I'm using Spring Java configuration (i.e. not XML). Most…
Alex Woolford
  • 4,433
  • 11
  • 47
  • 80
6
votes
6 answers

Spring Data JPA & MyBatis

I am trying to use Spring Data JPA with MyBatis. Since there isnt a Vendor Adapter for MyBatis, what is the alternative here?
srini
  • 544
  • 1
  • 11
  • 23
6
votes
1 answer

mybatis org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

I am using Spring MVC with Spring-Mybatis for performing basic CRUD operations using Annotations(@Insert, @Select etc) and getting this following exception org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): Here's a…
Lucky
  • 16,787
  • 19
  • 117
  • 151
6
votes
2 answers

Creating a table programmatically using MyBatis and MySql

I want to create a method to dynamically create tables just passing the table name as a variable. I have defined my xml mapper
MarMan
  • 328
  • 2
  • 3
  • 9
1
2 3
35 36