Код: Выделить всё
class Period {
private long id;
private String category;
private Date start;
private Date end;
@ManyToMany // Or @OneToMany
private Collection events
}
class Event {
private long id;
private String category;
private Date date;
}
Код: Выделить всё
select *
from period p
join event e on p.category = e.category
and e.date >= p.start
and e.date
Подробнее здесь: [url]https://stackoverflow.com/questions/79077540/custom-join-in-a-onetomany-or-manytomany-mapping-without-join-table[/url]
Мобильная версия