New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing rows when using @Arg and nested objects #3088
Comments
Hello @dirk-tf , It is not a bug. Note that there does not have to be a property in @Result(id = true, column = "ID") Specifying |
Oh, so just have to mark columns necessary for an ID. Ok i can work with that. Thanks alot. Though I really don't like the "un-configured default" potentially silently dropping rows. Re "subject", didn't fully understand you, but re-checking the code with the "non-complex" knowledge: removing it leaves none, disabling the cache. I actually already tried to set id=true on all @Args of both queries of test posted above. It didn't work. Setting any ids on "SectionResultMap" doesn't seem to affect "getTwice". Should it? Again huge thanks for you help, @harawata |
I know the behavior confuses users ( #512 #522 #580 #1848 ). Specifying You can use @Arg(id = true, name = "id", javaType = Integer.class)
@Arg(resultMap = "SectionResultMap", name = "section", columnPrefix = "PRE_", javaType = Section.class)
@Arg(column = "SUBJECT", name = "subject", javaType = String.class)
List<Post> getTwice(); record Post(Integer id, Section section, String subject) { } |
Hi, i'm trying to have my query return an object structure. In a similar way ConstructorColumnPrefixTest does, as multiple nested authors. But we had data/rows missing. From a quick glance, DefaultResultSetHandler.createRowKey seems... lacking. But i don't fully grasp it. Is this a bug or am I doing something unintended?
I've created a test case created with the current mybatis-3 master. The queries/objects are somewhat nonsensical, but the key point is the second should return another copy with a different int but doesnt.
MyBatis version
tested 3.5.15 and master
Database vendor and version
Both oracle and whatever the test uses, thus probably irrelevant.
Test case or example project
Steps to reproduce
run test above
Expected result
getTwice returns each row twice, with a different SOME_INT.
Actual result
Only set (5 rows right now) are returned. Actually, it works (10 rows) if you remove "String subject" from Post + the related @arg, confusing me even more
The text was updated successfully, but these errors were encountered: