Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Talk:EclipseLink/Development/2.4.0/JPA-RS/REST-API"

 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
--[[User:Tom.ware.oracle.com|Tom.ware.oracle.com]] 15:24, 21 December 2011 (UTC)  
 
--[[User:Tom.ware.oracle.com|Tom.ware.oracle.com]] 15:24, 21 December 2011 (UTC)  
 
PUT should not be used for INSERT.  PUT is supposed to be itempotent and because of the possibility of sequencing, creates are not itempotent.
 
PUT should not be used for INSERT.  PUT is supposed to be itempotent and because of the possibility of sequencing, creates are not itempotent.
** We should use PUT for update
+
* We should use PUT for update
** We should use POST for insert
+
* We should use POST for insert
  
 
--[[User:Douglas.clarke.oracle.com|Doug]] 15:18, 21 December 2011 (UTC) This should relate to JPA and therefore:
 
--[[User:Douglas.clarke.oracle.com|Doug]] 15:18, 21 December 2011 (UTC) This should relate to JPA and therefore:
Line 13: Line 13:
 
* Should we try to guarantee itempotency on PUT?
 
* Should we try to guarantee itempotency on PUT?
 
** A check for sequencing and then a does exist query?
 
** A check for sequencing and then a does exist query?
 +
 +
--[[User:Douglas.clarke.oracle.com|Doug]] 15:37, 21 December 2011 (UTC) I believe an em.merge does existence and sequence checking according to the descriptor's settings. I believe it would be idempotent for a new instance.
 +
 +
--[[User:Tom.ware.oracle.com|Tom.ware.oracle.com]] 16:42, 21 December 2011 (UTC)
 +
I think if you merge an object that has sequencing with its id field unpopulated, an insert will happen and sequencing will populate the identity field - hence if I did two consecutive puts with the same JSON object (with no identity field populated), it would result in two creates - not itempotent.

Latest revision as of 12:42, 21 December 2011

--Tom.ware.oracle.com 15:24, 21 December 2011 (UTC) PUT should not be used for INSERT. PUT is supposed to be itempotent and because of the possibility of sequencing, creates are not itempotent.

  • We should use PUT for update
  • We should use POST for insert

--Doug 15:18, 21 December 2011 (UTC) This should relate to JPA and therefore:

  • POST == EntityManager.persist
  • PUT == EntityManager.merge

The side-effect of this is that a merge of a new entity can result in an INSERT.

--Tom.ware.oracle.com 15:24, 21 December 2011 (UTC)

  • Should we try to guarantee itempotency on PUT?
    • A check for sequencing and then a does exist query?

--Doug 15:37, 21 December 2011 (UTC) I believe an em.merge does existence and sequence checking according to the descriptor's settings. I believe it would be idempotent for a new instance.

--Tom.ware.oracle.com 16:42, 21 December 2011 (UTC) I think if you merge an object that has sequencing with its id field unpopulated, an insert will happen and sequencing will populate the identity field - hence if I did two consecutive puts with the same JSON object (with no identity field populated), it would result in two creates - not itempotent.

Back to the top