microsoft / spring-data-cosmosdb

Access data with Azure Cosmos DB
MIT License
94 stars 64 forks source link

An user defined class as @Id #361

Open sheekaat opened 5 years ago

sheekaat commented 5 years ago

Currently, we can only use String, Integer or int types as a @id . If we want to use the composite unique key, then it's inevitable to use the low level api to set it on document entity. Is there an alternative way which avoids using low level API?

current implementation in the DocumentDbEntityInformation class, if (idField == null) { throw new IllegalArgumentException("domain should contain @Id field or field named id"); } else if (idField.getType() != **String.class** && idField.getType() != **Integer.class** && idField.getType() != **int.class**) { throw new IllegalArgumentException("type of id field must be String or Integer"); }

sheekaat commented 5 years ago

@sophiaso @xscript @Incarnation-p-lee Do we've Azure cosmos DB account to contribute to this? I created trial account but my free credit is all consumed because of the integration tests. I'm on Mac and I can't run the Emulator. Started doing this initially by modifying the DocumentDbEntityInformation class (Moving the condition of checking String, Integer or Int to the User defined class properties verification section). Let me know if there's an account available to use, so that I can resume on this.