Wrap your String
in a little entity.
@Table("NMT_CURRENTMOVIE")
class MovieId {
@Id
@Column("CM_ID")
final String id
// add constructor, equals and hashCode here or generate using Lombok
}
Then use it in the MovieTheatre
. Since you don't have a column for an index, the proper collection to use is a Set
// ...
class MovieTheatre {
// ...
@MappedCollection(idColumn="MOVIE_THEATRE_ID")
Set<MovieId> currentMovieIds;
}
Note that equals
and hashCode
is important as well as the constructor taking all arguments used in those, since the entity is used in a Set
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…