Spring Data JPA: Query for Field in List of Objects -


i'm looking correct method name find documents given target's type:

public class document {      @indexed(name = "targets")     private list<target> targets;      public class target {         private string value;         private string type;     } } 

unfortunately, of following method names aren't working:

list<document> findbytargettype(...); list<document> findbytargetstargettype(...); list<document> findbytargetscontainstargettype(...); list<document> findbytargetscontainstargettargettype(...); list<document> findbytargetscontainingtargettype(...); list<document> findbytargetscontainingtargettargettype(...); 

so correct method name accomplish desired feature?

you can try below query.

using @query annotation

@query("{ 'targets.type' : ?0 }") list<document> findbytargetstype(string type); 

or

using repository supported keywords

list<document> findbytargetstype(string type); 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -