You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our team is trying to use MyBatis instead of Hibernate on one of our projects and we picked up an intereseting bug.
We are using legacy DB (no way we can change it's structure) and almost all primary keys are VARBINARY.
The problem that we faced is "Nested Results for Collection" will not work properly when primary key is mapped to array field (VARBINARY gets mapped to byte[] in value object)
The test CacheKeyTest.shouldTestCacheKeysWithBinaryArrays is green so I'm pretty sure fix should be fine. However I'll double check on a sample application. Will let you know
Hi guys,
Our team is trying to use MyBatis instead of Hibernate on one of our projects and we picked up an intereseting bug.
We are using legacy DB (no way we can change it's structure) and almost all primary keys are VARBINARY.
The problem that we faced is "Nested Results for Collection" will not work properly when primary key is mapped to array field (VARBINARY gets mapped to byte[] in value object)
We've created a small project with unit tests that explain problem properly. Please find it here:
https://github.com/ekravchenko/testingzone/tree/master/mybatis.collection.mapping.bug
Please consider the following example. Let's say we have PersonVO:

ChildVO is very simple:

When the following result map is applied - collection mapping works as expected.

We will get 3 person items with collections of child items properly populated
However when we try same query with different result map where id is mapped to byte[]:

The test will not pass and we will get duplicates (7 person items instead of 3)
Bug can be reproduced using version 3.2.3 and the latest SNAPSHOT as well.
Thanks,
Yevgen Kravchenko
The text was updated successfully, but these errors were encountered: