Announcement Announcement Module
Collapse
No announcement yet.
Query on collection fields is not returning any results - SpringData project Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Query on collection fields is not returning any results - SpringData project

    I'm trying to fetch the outer documents( BetInfo's) given the list of "betCategories" using the following DAO.

    List<BetInfo> findByBetCategoriesIn(List<BetCategory> betCategories);

    It is not returning any results. Though I see records in database.

    Any ideas what am I doing wrong here?
    Using SpringData 1.0.0.M3.
    Thanks in advance.
    Code:
     DEBUG [org.springframework.data.document.mongodb.repository.MongoQueryCreator] - <Created query { "betCategories" : { "$in" : [ { "size" : 2}]}}>
    [org.springframework.data.document.mongodb.MongoTemplate] - <find using query: { "betCategories" : { "$in" : [ { "size" : 2}]}} fields: null for class: class com.mops.betting.domain.BetInfo in collection: betinfo>
    2
    
    public interface BetInfoDAO <T, ID extends Serializable>
    	extends MongoRepository<BetInfo, ObjectId>,
    	BetInfoDAOCustom<BetInfo, ObjectId>,
    	QueryDslPredicateExecutor<BetInfo> {
    	
    	List<BetInfo> findByBetCategoriesIn(List<BetCategory> betCategories);
    	
    }
    
    
    @Document(collection="betinfo")
    public class BetInfo implements Serializable {
    
    		@Id
    		private String id;		
    		@DBRef
    		private List<BetCategory> betCategories;
    		private BetState betState;
    }
    
    
    @Document(collection="betstate")
    public class BetState implements Serializable {
    
    		@Id
    		private String id;
    		private String state;
    }
    
    @Document(collection="betcategory")
    public class BetCategory implements Serializable {
    
    		@Id
    		private String id;
    		private String name;
    }
    Last edited by krishmn; Aug 17th, 2011, 06:43 AM.
Working...
X