Results 1 to 2 of 2

Thread: Spring data mongodb 1.0.1/1.0.2 bug?

  1. #1
    Join Date
    Oct 2008
    Location
    Santa Fe, NM
    Posts
    18

    Default Spring data mongodb 1.0.1/1.0.2 bug?

    Hi,
    I have the following interface for UserAccount account bean with String properties for username and password:
    Code:
    public interface UARepository extends MongoRepository<UserAccount, String> {
    	List<UserAccount> findByUsernameAndPassword(String username, String password);
    }
    Test code call:
    Code:
    List<UserAccount> users = uaRepository.findByUsernameAndPassword("jd","9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08");
    Under 1.0.1, the derived query is generated correctly:
    15:41:57.007 [main] DEBUG o.s.d.m.r.query.MongoQueryCreator - Created query { "username" : "jd" , "password" : "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd 15d6c15b0f00a08"}
    15:41:57.022 [main] DEBUG o.s.data.mongodb.core.MongoTemplate - find using query: { "username" : "jd" , "password" : "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd 15d6c15b0f00a08"} fields: null for class: class com.sustia.domain.UserAccount in collection: userAccount

    Under 1.0.2, the derived query is generated as:

    15:53:11.545 [main] DEBUG o.s.d.m.r.query.MongoQueryCreator - Created query Query: { "password" : "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd 15d6c15b0f00a08" , "$and" : [ { "password" : "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd 15d6c15b0f00a08"}]}, Fields: null, Sort: null
    15:53:11.549 [main] DEBUG o.s.data.mongodb.core.MongoTemplate - find using query: { "password" : "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd 15d6c15b0f00a08" , "$and" : [ { "password" : "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd 15d6c15b0f00a08"}]} fields: null for class: class com.sustia.domain.UserAccount in collection: userAccount

    Thanks,
    John

  2. #2
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    493

    Default

    It seems you've stumbled over https://jira.springsource.org/browse/DATAMONGO-469. It's aleady fixed in 1.0.x and 1.1.x branches so feel free to give the snapshots a try.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •