Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching An object from @ElementCollection

I am using Spring Data JPA.

I an entity like this

public class A {

    @CollectionTable(name = "B_ITEMS", joinColumns = @JoinColumn(name = "B_ID"))
    @ElementCollection
    private List<B> bs;

}

And an Embedded class

@Embeddable
public class B { 

private String prop1


private String prop2


private String prop3

}

How do I search entity A using the contents @ElementCollection B?

And here's my repository Spring Data JPA Repositry

public interface ARepo extends PagingAndSortingRepository<Clinic, Long> {

}

What Query method name is applicable for my use case?

like image 252
user962206 Avatar asked Feb 17 '16 09:02

user962206


1 Answers

You seem to be asking for a basic IN query in Spring Data - findBybsIn(List<B> bs)

like image 57
DSS Avatar answered Sep 21 '22 21:09

DSS