File tree 3 files changed +61
-0
lines changed
src/test/java/org/springframework/data/elasticsearch 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -164,4 +164,20 @@ public void shouldBuildMappingsForGeoPoint() throws IOException {
164
164
assertThat (result , containsString ("\" pointC\" :{\" type\" :\" geo_point\" " ));
165
165
assertThat (result , containsString ("\" pointD\" :{\" type\" :\" geo_point\" " ));
166
166
}
167
+
168
+ /**
169
+ * DATAES-260 - StacOverflow when two reverse relationship.
170
+ */
171
+ @ Test
172
+ public void shouldHandleReverseRelationship () {
173
+ //given
174
+ elasticsearchTemplate .createIndex (User .class );
175
+ elasticsearchTemplate .putMapping (User .class );
176
+ elasticsearchTemplate .createIndex (Group .class );
177
+ elasticsearchTemplate .putMapping (Group .class );
178
+ //when
179
+
180
+ //then
181
+
182
+ }
167
183
}
Original file line number Diff line number Diff line change
1
+ package org .springframework .data .elasticsearch .entities ;
2
+
3
+ import java .util .HashSet ;
4
+ import java .util .Set ;
5
+
6
+ import org .springframework .data .annotation .Id ;
7
+ import org .springframework .data .elasticsearch .annotations .Document ;
8
+ import org .springframework .data .elasticsearch .annotations .Field ;
9
+ import org .springframework .data .elasticsearch .annotations .FieldType ;
10
+
11
+ /**
12
+ * Created by akonczak on 21/08/2016.
13
+ */
14
+
15
+ @ Document (indexName = "groups" , type = "group" )
16
+ public class Group {
17
+
18
+ @ Id
19
+ String id ;
20
+
21
+ @ Field (type = FieldType .Nested , ignoreFields ={"groups" })
22
+ private Set <User > users = new HashSet <User >();
23
+ }
Original file line number Diff line number Diff line change
1
+ package org .springframework .data .elasticsearch .entities ;
2
+
3
+ import java .util .HashSet ;
4
+ import java .util .Set ;
5
+
6
+ import org .springframework .data .annotation .Id ;
7
+ import org .springframework .data .elasticsearch .annotations .Document ;
8
+ import org .springframework .data .elasticsearch .annotations .Field ;
9
+ import org .springframework .data .elasticsearch .annotations .FieldType ;
10
+
11
+ /**
12
+ * Created by akonczak on 21/08/2016.
13
+ */
14
+
15
+ @ Document (indexName = "users" , type = "user" )
16
+ public class User {
17
+ @ Id
18
+ private String id ;
19
+
20
+ @ Field (type = FieldType .Nested ,ignoreFields ={"users" })
21
+ private Set <Group > groups = new HashSet <Group >();
22
+ }
You can’t perform that action at this time.
0 commit comments