- 
 
- 
  Notifications
 You must be signed in to change notification settings 
- Fork 3.7k
MERGE support for HQL/Criteria #5896
 
 
 beikov
 
 
 
 started this conversation in
 Design Proposals
 
 -
Support the SQL standard MERGE statement. Essentially it's like INSERT with the CONFLICT clause, but also offers the possibility to do DELETEs/UPDATEs. Quite a few DBMS support this. The concurrency guarantees of the statement AFAIU allows such a statement to be implemented by executing the individual parts as separate statements, so emulation should be possible.
Also see:
- https://en.wikibooks.org/wiki/Structured_Query_Language/MERGE
- https://en.wikipedia.org/wiki/Merge_(SQL)
Syntax-wise I would suggest we follow the SQL standard approach which seems sane to me.
merge_statement : MERGE INTO entityName (AS identifier)? USING fromRoot ON predicate merge_when_clause+; merge_when_clause : WHEN MATCHED (AND predicate)? THEN (UPDATE setClause | DELETE) | WHEN NOT MATCHED (AND predicate)? THEN insertStatement ;
Beta Was this translation helpful? Give feedback.
All reactions
- 
 👍 9
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
All reactions
 
 0 replies
 
 
 
 
 Sign up for free
 to join this conversation on GitHub.
 Already have an account?
 Sign in to comment