Upgrading from 3.1.0 to a newer version

105 views
Skip to first unread message

Tomás Ortí

unread,
Jan 12, 2021, 11:30:31 AM1/12/21
to mybatis-user
Hello!
An application is running with MyBatis 3.1.0.
I need to investigate if it is possible to upgrade MyBatis to a newer version.
And how much effort and time would it take.

The application was conceived using mybatis generator.
So, it is composed by auto-generated XML and Java files. 
Although it also evolved using custom made Mapped statements.
So, it also has custom XML files and POJOs.

I would appreciate some feedback about which are the main points a migration like this could come across.
Checking Github repository showed that many things have changed since version 3.1.0.
So it would be good to know if a newer version is backward compatible and any other issues that could arise.

Thanks you very much!!    

Guy Rouillier

unread,
Jan 12, 2021, 11:06:25 PM1/12/21
to MyBatis User
Give it a try.  Been several years since 3.1.0, so I truthfully don't remember any migration.  The 3.x series should be backwards compatible.  Post back with any specific issues you encounter.

--
Guy Rouillier
--
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 mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/21d90f5a-249a-4cfa-a71e-70894156b778n%40googlegroups.com.

Jeremy Landis

unread,
Jan 13, 2021, 6:12:00 PM1/13/21
to mybatis-user
3.5.x requires jdk 8.
3.4.x or somewhere around there was a bit more strict so if really bad code to the mappers that used to just work, it will not any longer.

For most it is rather drop in place.

Tomás Ortí

unread,
Jan 21, 2021, 11:45:10 AM1/21/21
to mybatis-user
Ok, compilation with 3.5.6 reported no errors.
Though when starting the app, the first error to appear is this one:

### Error building SqlSession.
### The error may exist in com/ericsson/m2m/common/utils/persistence/impl/mybatis/custom/xml/CustomerOptimalMapper.xml
### The error occurred while processing mapper_resultMap[CustomerMatch]
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'com/ericsson/m2m/common/utils/persistence/impl/mybatis/custom/xml/CustomerOptimalMapper.xml'. Cause: java.lang.IllegalStateException: Mapping is missing column attribute for property id

So it seems it is failing when XMLMapperBuilder is parsing the XML file.
Something is wrong (needs to be fixed) in <resultMap id="CustomerMatch" 

Some help would be appreciated.

Best Regards.
CustomerOptimalMapper.xml

Tomás Ortí

unread,
Jan 21, 2021, 12:26:21 PM1/21/21
to mybatis-user
It is complaining of id property on:

<resultMap id="CustomerMatch" type="com.ericsson.m2m.common.utils.persistence.impl.mybatis.custom.model.CustomerMatch">
<id property="id" jdbcType="VARCHAR" />
<result property="value0" jdbcType="VARCHAR" column="value0" />

Due to this code:
mybatis.png

Adding column="id"
<id property="id" jdbcType="VARCHAR" column="id" />
seeems to solve the error.
Reply all
Reply to author
Forward
0 new messages