규호 (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=624fda4...
) *created* an issue
Bean Validation (
https://hibernate.atlassian.net/browse/BVAL?atlOrigin=eyJpIjoiMmQyZTdlOGR...
) / Bug (
https://hibernate.atlassian.net/browse/BVAL-783?atlOrigin=eyJpIjoiMmQyZTd...
) BVAL-783 (
https://hibernate.atlassian.net/browse/BVAL-783?atlOrigin=eyJpIjoiMmQyZTd...
) @BatchSize with @ManyToMany does not work as expected when migrating 5 -> 6 (
https://hibernate.atlassian.net/browse/BVAL-783?atlOrigin=eyJpIjoiMmQyZTd...
)
Issue Type: Bug Assignee: Unassigned Created: 09/Jan/2023 05:45 AM Environment: - Spring
Boot 3.0.1
- Hibernate 6.1.6.Final Priority: Major Reporter: 규호 (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=624fda4...
)
Description
Repo to reproduced the issue chlrbgh89/hibernate-batch-size-bug (
https://github.com/chlrbgh89/hibernate-batch-size-bug )
Post about this issue [
@BatchSize with @ManyToMany does not work as expected when migrating 5 ->
6|https://discourse.hibernate.org/t/batchsize-with-manytomany-does-not-wo...]
@BatchSize with @ManyToMany does not work as expected when migrating 5 -> 6
Summary
When using @BatchSize with @ManyToMany in Hibernate 5.6.14.Final, it generated queries:
```
Hibernate: select article0_.id as id1_0_, article0_.category_id as category2_0_ from
article article0_ order by article0_.id DESC limit ?
Hibernate: select tags0_.article_id as article_1_1_1_, tags0_.tags_id as tags_id2_1_1_,
tag1_.id as id1_2_0_, tag1_.name as name2_2_0_ from article_tags tags0_ inner join tag
tag1_ on tags0_.tags_id=tag1_.id where tags0_.article_id in (?, ?, ?, ?, ?)
```
However In Hibernate 6.1.6:
```
Hibernate: select t1_0.article_id,t1_1.id,t1_1.name from article_tags t1_0 join tag t1_1
on t1_1.id=t1_0.tags_id where t1_0.article_id in(?,?,?,?,?)
Hibernate: select t1_0.article_id,t1_1.id,t1_1.name from article_tags t1_0 join tag t1_1
on t1_1.id=t1_0.tags_id where t1_0.article_id in(?,?)
Hibernate: select t1_0.article_id,t1_1.id,t1_1.name from article_tags t1_0 join tag t1_1
on t1_1.id=t1_0.tags_id where t1_0.article_id in(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
```
Hibernate 6.1.6 generated queries 2 more and binded data in each query were article-id
that had empty tag list. And the values in IN clause at the last query was always
generated as much as the size of @BatchSize.
Environment
* Spring Boot 3.0.1
* Hibernate 6.1.6.Final
(
https://hibernate.atlassian.net/browse/BVAL-783#add-comment?atlOrigin=eyJ...
) Add Comment (
https://hibernate.atlassian.net/browse/BVAL-783#add-comment?atlOrigin=eyJ...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100213- sha1:1fa7b87 )