Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Query for nested property causes wrong param identifier in query #221

Closed
jannhendrik opened this issue Oct 1, 2018 · 5 comments
Closed

Comments

@jannhendrik
Copy link
Collaborator

jannhendrik commented Oct 1, 2018

For

class User {
  ... 
  private Person person;
   ...
}

class Person {
   ....
   private ZonedDateTime birthdatetime;
   ....
}
class SomeRepo {
      List<User> findByPerson_Birthdatetime(@Param("birthdatetime ") ZonedDateTime birthdatetime )
}

the following query is generated.

"SELECT * FROM ROOT r WHERE r.person.birthdatetime > @person.birthdatetime "

Which throws an exception because paramter names 'must conform to @ followed by a valid identifier'.

@Incarnation-p-lee
Copy link
Contributor

@jannhendrik
Thanks for your issue. As National festival, sorry for late response. I will try to reproduce this from my env.

Incarnation-p-lee added a commit that referenced this issue Oct 10, 2018
* For nested query with DocumentQuery, replace user.name to user_name.

Signed-off-by: Pan Li <[email protected]>
Incarnation-p-lee added a commit that referenced this issue Oct 10, 2018
* For nested query with DocumentQuery, replace user.name to user_name.

Signed-off-by: Pan Li <[email protected]>
@kweheliye
Copy link

Hi,
Is this issue has been solved ? I'm still getting the same error

"message": "com.microsoft.azure.documentdb.DocumentClientException: Message: {\"Errors\":[\"Invalid query. Specified parameter name '@identifications.unitId' is invalid. Parameter names should be in the format of symbol '@' followed by a valid identifier. E.g. @param1\"]}\r\nActivityId: 4b21e05f-0fa6-40e0-ab22-2ae5755a2515, Request URI: /apps/7da5b391-0f9a-491d-ba27-5ec488c34aff/services/0435fed3-5839-4b67-925d-24552c7e0aea/partitions/d556cadf-1ef4-404b-86c1-9ba2403a1831/replicas/131824899814612693p, RequestStats: \r\nRequestStartTime: 2018-11-27T14:54:50.9400203Z, Number of regions attempted: 1\r\nResponseTime: 2018-11-27T14:54:50.9500049Z, StoreReadResult: StorePhysicalAddress: rntbd://10.0.0.103:14000/apps/7da5b391-0f9a-491d-ba27-5ec488c34aff/services/0435fed3-5839-4b67-925d-24552c7e0aea/partitions/d556cadf-1ef4-404b-86c1-9ba2403a1831/replicas/131824899814612693p, LSN: 11516, GlobalCommittedLsn: 11516, PartitionKeyRangeId: 0, IsValid: True, StatusCode: 400, IsGone: False, IsNotFound: False, IsInvalidPartition: False, RequestCharge: 1, ItemLSN: -1, SessionToken: 11516, ResourceType: Document, OperationType: Query\r\n, SDK: Microsoft.Azure.Documents.Common/2.1.0.0, StatusCode: BadRequest" }
I have similar below code

`class User {
...
private Person person;
...
}

class Person {
....
private String name;
....
}`

@Incarnation-p-lee
Copy link
Contributor

@kweheliye
Thanks for issue this, we should fix this issue and add integration test for that.
Could you please provide more information about this ? Like which version of spring-data-cosmosdb, ?

@kweheliye
Copy link

kweheliye commented Nov 27, 2018

I'm not on my deskright now, but I think 2.0.5 with spring boot 2.0.2.RELEASE.

However I was able to fetch the child object or the nested object only by passing the nested object as parameter along with the nested object's properties fully populated.

So passing object who it's properties partially filled in will return empty.

Is there a workaround while the issue is being fixed ?

@Incarnation-p-lee
Copy link
Contributor

@kweheliye the 2.0.5 version may not contains that fix, it merged into master at 11 Oct. And 3.0.0.M1 is migrate to new SDK branch out early Oct also missed that fix. We would like to release new version like for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants