This isn't a problem, its more of a "is this the right approach" kind of deal.
So lets say I have a model like this
class A extends Model{
@OneToMany(cascade = CascadeType.ALL)
public B;
}
class B extends Model{
String c;
}
Now I want to access all objects of A that have a particular value of c in their B objects.
So should I:
- Get all objects of B with a certain value c and then find corresponding A's with those objects(if so how, getting confused)
- Get all objects of A with
find.all()
then look through the list (seems a bad idea as there will be a large amount of A's and not so many B's).
Any help would be appreciated (oh and assume I've written @Entity
and @Required
and all the rest appropriately)