Skip to content

Commit dde68da

Browse files
author
Vincent Bouthinon
committed
HHH-19285 : @ManyToAny with @FilterJoinTable KO
Test for reproduce. https://hibernate.atlassian.net/browse/HHH-19285
1 parent dc20229 commit dde68da

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
package org.hibernate.orm.test.associations.any;
6+
7+
import jakarta.persistence.Entity;
8+
import jakarta.persistence.GeneratedValue;
9+
import jakarta.persistence.Id;
10+
import jakarta.persistence.JoinColumn;
11+
import jakarta.persistence.JoinTable;
12+
import org.hibernate.annotations.AnyKeyJavaClass;
13+
import org.hibernate.annotations.FilterJoinTable;
14+
import org.hibernate.annotations.ManyToAny;
15+
import org.hibernate.boot.MetadataSources;
16+
import org.hibernate.testing.orm.junit.JiraKey;
17+
import org.hibernate.testing.orm.junit.NotImplementedYet;
18+
import org.hibernate.testing.orm.junit.ServiceRegistry;
19+
import org.hibernate.testing.orm.junit.ServiceRegistryScope;
20+
import org.junit.jupiter.api.Test;
21+
22+
import java.util.ArrayList;
23+
import java.util.List;
24+
25+
26+
/**
27+
* The annotation @FilterJoinTable is incorrectly not accepted by @ManyToAny, which always utilizes a @JoinTable.
28+
*
29+
* @author Vincent Bouthinon
30+
*/
31+
@ServiceRegistry()
32+
@JiraKey("HHH-19285")
33+
class ManyToAnyWithFilterJoinTableTest {
34+
35+
@NotImplementedYet
36+
@Test
37+
void testManyToAnyWithFilterJoinTable(ServiceRegistryScope registryScope) {
38+
final MetadataSources metadataSources = new MetadataSources( registryScope.getRegistry() )
39+
.addAnnotatedClasses( ObjectTest.class );
40+
metadataSources.buildMetadata();
41+
}
42+
43+
@Entity
44+
public static class ObjectTest {
45+
46+
@Id
47+
@GeneratedValue
48+
private Long id;
49+
50+
@ManyToAny
51+
@AnyKeyJavaClass( Long.class )
52+
@JoinTable(name = "linkTable", joinColumns = @JoinColumn(name = "SOURCE"), inverseJoinColumns = @JoinColumn(name = "DEST"))
53+
@FilterJoinTable(name= "filter", condition = "1=1")
54+
private List<Object> list = new ArrayList<>();
55+
}
56+
}

0 commit comments

Comments
 (0)