Hello,
I am trying to build a RESTful web application using Groundhog for persistence. In order to generate URLs for my entities (e.g. for the Location HTTP header), I need a way, given that I have an entity, to obtain its id (its AutoKey). From what I've gathered so far, in normal Groundhog usage, the primary key is not part of the actual entity datatype. The only place where I've seen it returned is from the 'insert' functions in Database.Groundhog. I need the id in cases where I have retrieved an already-existing entity using 'select', but I cannot find a way to obtain it.
I gather that this might not be possible with the current API, and that instead, I may need to explicitly define a field on the entity type to store the id instead of using the auto-generated field that Groundhog normally provides. In that case, my question is how do I set up that field to be an auto-incrementing key, and not simply a value with a unique constraint. Also, would Groundhog recognize that field as the AutoKey, and would it return it from 'insert' calls?
Thanks,
Ross Pokorny