I have two tables. Table A and B. Table A is a main table of objects and table B has statistics for table A (many records with timestamps and so on). So now I have mapped A and B with OneToMany on A side and want to filter the B results when table A gets loaded from database.
This is in class Game (table A). GameStatistics is table B.
Code:
@OneToMany(fetch=FetchType.EAGER, cascade=CascadeType.ALL)
@JoinColumn(name="gameid")
@OrderBy(value="datetime")
private Set<GameStatistics> gameStatistics;
So when I load entity Game I want to sort/filter results of GameStatistics (for example by date/timestamp).
Is it possible?