-
Notifications
You must be signed in to change notification settings - Fork 13k
Description
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:
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