query not work when changing class name
It can happen when there are some change to class name when migrate system, split system, ...
the class name origin is AccountHasPrivilege
then changed to HeadquarterUserAccountHasPrivilege
// before
{ "_id": { "$oid": "randomId" }, "accountId": "accountId", "privilegeCode": "create.any", "resourceType": "headquarter", "isDeleted": false, "isDisabled": false, "updatedAt": 1661154267998, "createdAt": 1661154267998, "_class": "com.techproai.parkingxcloud.models.AccountHasPrivilege"
}
public class Test { public static void main() { HeadquarterUserAccountHasPrivilege privilege = new HeadquarterUserAccountHasPrivilege(); privilege.setAccountId("accountId"); repository.findAll(Example.of(privilege)); // not work, not found repository.findByAccountId("accountId"); // work }
}
then I need to change "_class": "com.techproai.parkingxcloud.models.HeadquarterUserAccountHasPrivilege"
then it work again
// after
{ "_id": { "$oid": "randomId" }, "accountId": "accountId", "privilegeCode": "create.any", "resourceType": "headquarter", "isDeleted": false, "isDisabled": false, "updatedAt": 1661154267998, "createdAt": 1661154267998, "_class": "com.techproai.parkingxcloud.models.HeadquarterUserAccountHasPrivilege"
}