mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-29 15:22:11 +00:00
DATAES-260 added missing test
This commit is contained in:
parent
2718be7c07
commit
7a95cb64a8
@ -164,4 +164,20 @@ public class MappingBuilderTests {
|
|||||||
assertThat(result, containsString("\"pointC\":{\"type\":\"geo_point\""));
|
assertThat(result, containsString("\"pointC\":{\"type\":\"geo_point\""));
|
||||||
assertThat(result, containsString("\"pointD\":{\"type\":\"geo_point\""));
|
assertThat(result, containsString("\"pointD\":{\"type\":\"geo_point\""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DATAES-260 - StacOverflow when two reverse relationship.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void shouldHandleReverseRelationship() {
|
||||||
|
//given
|
||||||
|
elasticsearchTemplate.createIndex(User.class);
|
||||||
|
elasticsearchTemplate.putMapping(User.class);
|
||||||
|
elasticsearchTemplate.createIndex(Group.class);
|
||||||
|
elasticsearchTemplate.putMapping(Group.class);
|
||||||
|
//when
|
||||||
|
|
||||||
|
//then
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.springframework.data.elasticsearch.entities;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Field;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by akonczak on 21/08/2016.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Document(indexName = "groups", type = "group")
|
||||||
|
public class Group {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
String id;
|
||||||
|
|
||||||
|
@Field(type = FieldType.Nested, ignoreFields ={"groups"})
|
||||||
|
private Set<User> users = new HashSet<User>();
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package org.springframework.data.elasticsearch.entities;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Field;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by akonczak on 21/08/2016.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Document(indexName = "users", type = "user")
|
||||||
|
public class User {
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Field(type= FieldType.Nested,ignoreFields={"users"})
|
||||||
|
private Set<Group> groups = new HashSet<Group>();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user