I' ve got 2 tables... Challenge and ChallengeYear, ChallengeYear is only to create a list of years in challenge.
I only want to make Challenge an entity, containing a list of List years. Is this possible?
I've looked in to @SecondaryTable together with @JoinColumn and @OneToMany, but neither of those can do the trick, or i am overlooking something.
Can someone help me?
Greetings, Jan
What is Year in your model, is it an Integer ?
if yes, you may annotate your Challenge.getYears method with @CollectionOfElements
like:
@CollectionOfElements
@JoinTable(
table=@Table(name="ChallengeYear"),
joinColumns = @JoinColumn(name="challengeId")
)
@Column(name="year", nullable=false)
List<Integer> getYears() {
...