After adding new Column Mybatis generator generate class without the new column

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

After adding new Column Mybatis generator generate class without the new column

Nazih
Hi group,


i use spring(3.1.1), maven(version 3.5.2), mybatis(version 3.2.2) and mybatis-spring(version:1.2.5)
i have a problem since yesterday, i didn't observe it bevore. After adding new column or changing the name of existing a column and start the Mybatis generator like (mvn mybatis-generator:generate). The Mybatis generate a class but with the old version of the table. That means, it does not recognize the changes in the table. 

1)my generatorConfig.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
  PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
  "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">

<generatorConfiguration>

<context id="mytables" targetRuntime="MyBatis3">

        <plugin type="org.mybatis.generator.plugins.SerializablePlugin" />

<jdbcConnection driverClass="oracle.jdbc.OracleDriver"
connectionURL="jdbc:oracle:thin:@host:port:sid" userId="user"
password="pass">
</jdbcConnection>

<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<javaModelGenerator targetPackage="persistence.model"
targetProject="MAVEN">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>

<sqlMapGenerator targetPackage="persistence.xml"
targetProject="MAVEN">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>

<javaClientGenerator type="XMLMAPPER"
targetPackage="persistence.dao" targetProject="MAVEN">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<table tableName="MESSAGELOG" domainObjectName="MessageLogEntry">
<property name="useActualColumnNames" value="false" />
</table>
others tables

</context>

</generatorConfiguration>

2)pluging in pom.xml looks like:

<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>Generate MyBatis Artifacts</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>12.1.0.2.0</version>
</dependency>
</dependencies>
<configuration>
<configurationFile>src/main/config/generatorConfig.xml</configurationFile>
<overwrite>true</overwrite>
</configuration>
</plugin>


Any ideas?

Kind regards
Nazih


--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: After adding new Column Mybatis generator generate class without the new column

Nazih
i added new table as an experiment and i run the mybatis generator. it geneare the java class for the new table correctly. the same goes when i add new column to the new table. 
Mybatis generate correctly the java class for the new table. 
But for the old tables the mybatis generate always the java classes without the last changements.  

Nazih 

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: After adding new Column Mybatis generator generate class without the new column

Jeff Butler
With this configuration, when you run the generator for your existing table, it will write the generated files into the  .../target/generated-sources/mybatis-generator directory in your maven project.  Did you look there for the new files?

Jeff Butler


On Thu, Mar 22, 2018 at 10:05 AM Nazih <[hidden email]> wrote:
i added new table as an experiment and i run the mybatis generator. it geneare the java class for the new table correctly. the same goes when i add new column to the new table. 
Mybatis generate correctly the java class for the new table. 
But for the old tables the mybatis generate always the java classes without the last changements.  


Nazih 

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: After adding new Column Mybatis generator generate class without the new column

Nazih-2
it write the generated files into the .../target/generated-sources/mybatis-generator directory and the generated java classes are up to date, but i can't see there my last changement in the table.
i mean the new added column was not recognized.
I noticed the following, when the table was created in 2018, mybatis generate the expected java classes correctly. 
when the table was created bevore 2018, mybatis does not recognize the changes in the table in 2018 and generate java class based on the old version of the table.
that is strange!!!

Nazih

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.