I'm trying to add a new entity using an ODATA Web Service, but the entity's Id 
field is an auto-incremented field on the server.  This means that when I pass 
the entity for adding, I don't know the Id that will be assigned, and I need 
some way of retrieving that value after the entity is added.

In looking at the org.restlet.ext.odata.Service class, the addEntity() method 
posts the new entity, gets a Representation (response), and processes it using 
an Entry/EntryContentHandler, adding it to a Feed... and then it's all just 
thrown away (??).  It seems like it's doing all the work to allow returning of 
the entity, but not actually doing so :(

I tried waiting until after the addEntity() call returned and then using 
svc.latestResponse to repeat the same processing (with 
Entry/EntryContentHandler), but the internal buffer/channels are already 
consumed (?), so it's not parsing anything and eventually throwing an exception 
saying "Premature end of file" (since there's no data to parse).  It's possible 
there's a way to "reset" the channels or something, but that seems redundant 
anyway, since the processing has already been in addEntity().

Is there some way that I'm missing to retrieve the entity that's added from 
this addEntity() call?  If not, perhaps addEntity() could be changed to return 
the entity object that has been added?

Thanks!

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2879321

Reply via email to