java - Spring Data: string lookup in complex object -


i have following pojo object:

 public class address {     private string country;     private string city;     private string street;     private string building;     private string room; } 

and following mongo entity:

@document(collection = "corporatetransport") public class corporatetransport {     @id     private string id;     private address from;     private address to; } 

also have repository:

public interface corporatetransportrepository extends crudrepository<corporatetransport, string> { } 

i find corporatetransport documents address country 'republic'. how can it? should write @query or crudrepository can handle it?

you dont need @query annotation @ all.

try example:

public interface corporatetransportrepository extends crudrepository<corporatetransport, string> {   list<corporatetransport> findbyfrom_countrycontainingignorecaseorto_countrycontainingignorecase(string country); } 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -