Questions tagged [mybatis-generator]

MyBatis Generator (MBG) is a code generator for MyBatis MyBatis and iBATIS.

According to mybatis

MyBatis Generator (MBG) is a code generator for MyBatis MyBatis and iBATIS. It will generate code for all versions of MyBatis, and versions of iBATIS after version 2.2.0. It will introspect a database table (or many tables) and will generate artifacts that can be used to access the table(s). This lessens the initial nuisance of setting up objects and configuration files to interact with database tables. MBG seeks to make a major impact on the large percentage of database operations that are simple CRUD (Create, Retrieve, Update, Delete). You will still need to hand code SQL and objects for join queries, or stored procedures.

97 questions
12
votes
4 answers

Should JPA entities and DDD entities be the same classes?

There are classes that are entities according to DDD, and there are classes that have @javax.persistence.Entity annotation. Should they be the same classes? Or should JPA entities act just as a mechanism for a mapper…
12
votes
4 answers

Mybatis Generator: What's the best way to separate out "auto generated" and "hand edited files"

I am on a project that uses both Mybatis (for persisting java to database) and Mybatis Generator (to automatically generate the mapper xml files and java interfaces from a database schema). Mybatis generator does a good job at generating the files…
user331465
  • 2,984
  • 13
  • 47
  • 77
11
votes
1 answer

What are the return values for the mybatis update functions?

We're using MyBatis 3.0.6 to work with our database. The MyBatis generator will automatically generate 4 updateByXYZ() methods. Each of these methods returns an int. I've been digging all over but can't find any documentation telling me what…
Kricket
  • 4,049
  • 8
  • 33
  • 46
7
votes
4 answers

MyBatis: underscore not mapped to camelcase

My problem is simple. I have a column name product_name in my product table in my mysql database but in my Product class (java), camelcase is used in productName. MyBatis is not mapping product_name to productName. Any solution for this? I had no…
rhandom
  • 1,198
  • 3
  • 10
  • 15
6
votes
2 answers

mybatis generator "Column name pattern can not be NULL or empty"

I am using MyBatis Generator in eclipse. Here is the generatorConfig.xml file. When I right click and choose to "generate MyBatis artifacts", it show me the error message like "Column name pattern can not be NULL or empty".
TryMyBest
  • 333
  • 5
  • 11
5
votes
4 answers

MyBatis not working with Boolean mapping

I am just trying to map a boolean value with Mybatis, but I am having a problem. Firstly, I'll show you the parts involved: XML File:
stack man
  • 2,303
  • 9
  • 34
  • 54
4
votes
2 answers

Mybatis Generator: How to generate all tables for a specified schema

Mysql database totally has 4 schemas, and I just want to generate a specified schema named 'booking'. But it always generate all tables for all schemas. So I need your help. Below is my generatorConfig.xml.
danny
  • 427
  • 1
  • 15
  • 25
4
votes
5 answers

How could let MyBatis Generator overwriting the already generated *Mapper.xml?

Like title, when i execute the mybatis-generator, i want to overwriting the already generated *Mapper.xml all, not merge! but i try many config way, it doesn't implement correct. and everytime is generator the more once the xml content. like…
kookob
  • 143
  • 1
  • 8
3
votes
2 answers

MyBatis, Select Provider and SQLBuilder

this is more than a simple question and my English is not as good as I want... I'll try my best. I use java 8, with Mybatis 3.4.6 over Postgres 9.6 and I need to do a custom dynamic query. In my mapper.java class I've created a method to use with…
Fjordo
  • 768
  • 3
  • 18
  • 40
3
votes
2 answers

mapping input and output parameters with MyBatis

I am learning how to use MyBatis. Honestly I like this framework very well. It is easy to use and I am happy with it because I can use my sql commands with it :) I use MyBatis 3.4.2 and PostgreSQL database. For example I like how easy to execute a…
zappee
  • 20,148
  • 14
  • 73
  • 129
3
votes
2 answers

Flyway Gradle plugin - Circular dependency

I have a project that uses gradle, flyway gradle plugin, mybatis generator and postgres. In my build.gradle, I have: compileJava.dependsOn('myBatisGenerator') I would like to run the flywayMigrate task before myBatisGenerator runs. So I did the…
MojoJojo
  • 3,897
  • 4
  • 28
  • 54
2
votes
1 answer

Mybatis Insert PK manually

I am trying to single insert data into table with assigned PK. Manually assiging PK. XML file
2
votes
1 answer

How to configure behaviour of mapper.insertSelective(record) method generated by MyBatisGenerator. using JUnit4 and Mockito?

In my WebApp, I have used MyBatisGenerator to generate mapper interfaces. I have a class UserService as follows: public class UserService { @Autowired UserMapper userMapper; public int create(UserParams userParams) { User user…
Karthik Pai
  • 587
  • 1
  • 9
  • 18
2
votes
1 answer

Mybatis generator addRemarkComments for oracle not working

I use mybatis generator with maven in eclipse. I want to add comments on the generated classes, fields and methods. I configured coomentGenerator as below but it does not add any comments.
2
votes
1 answer

Mybatis generator xml configuration. Set join between tables

I have three tables: table ONE pk:ONE.ID table TWO fk:TWO.ID with ONE.ID pk:TWO.ID TWO.FIELD table THREE fk:TWO.ID with THREE.ID and TWO.FIELD=THREE.FIELD Is it possible to set the join in the xml configuration, and let mybatis to generate the…
michele
  • 26,348
  • 30
  • 111
  • 168
1
2 3 4 5 6 7