I am using Spring Data JPA.
I an entity like this
public class A {
@CollectionTable(name = \"B_ITEMS\", joinColumns = @JoinColumn(name = \"B_ID\"))
@ElementCollection
is just a simple way to map a @OneToMany
relation.
As such you can join them as usual:
public interface ARepo extends PagingAndSortingRepository {
@Query("select a from A a join a.bs b where b.prop1 = :prop1 and ...")
A findByProps(@Param("prop1") String prop1)
}