I'm using spring-boot-starter-data-jdbc 2.4.2. In my domain aggregate I need to map a List of Strings that is populated from a column in another table. It is a legacy database so I have no control over the table and column names and need to use custom names. I see there is an @MappedCollection annotation, but can't see how to use it in this scenario. Below is my class:
@Data
@Table("NMT_MOVIE_THEATRE")
public class MovieTheatre {
@Id
@Column("MOVIE_THEATRE_ID")
private Long id;
@Column("ZIP_CODE")
private String zipCode;
// this comes from table NMT_CURRENT_MOVIE, column CM_ID, joined by MOVIE_THEATRE_ID
private List<String> currentMovieIds;
}
Using Spring Data JDBC, how can I create the one-to-many relation?
question from:https://stackoverflow.com/questions/65898476/spring-data-jdbc-one-to-many-with-custom-column-name