'Spring data: How to ignore field for relational database but not in elasticsearch?
I have a problem with spring data and the @Transient annotation, in fact I have a class as follows:
@Table("example")
@Document(indexName = "example")
public class Example implements Serializable {
@Id
@Column("id")
private Long id;
@Transient
@Field(type = FieldType.Nested, includeInParent = true)
private User user;
@Column("user_id")
private Long userId;
...getter and setter
}
I have a relational database and an elasticsearch.
In the database I just want to save the id and userId (and it works with this code).
but in elasticsearch I want to save the id and the user.
If I remove @Transient I get an error with R2dbc:
Nested entities are not supported in r2dbcEntityTemplate.insert
Does anyone know how to ignore it with R2dbc and take it into account with elasticsearch?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
