SQL : Merge query support
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Querydsl |
Invalid
|
Medium
|
Unassigned |
Bug Description
Provide a merge query that will work on DBMSs that do not support merge. It would work by using the data entered into the columns() and values() methods to generate a where clause automatically. An ID would be entered in the key() method and that data would be used to generate the Querydsl list() request. When a list of IDs is returned that list would be used to generate an update statement. The values that are not in the list of IDs would be used to generate an insert statement. The whole operation would return a unified list of IDs from the update command and the insert command. Many times, a merge command is used to insert or update a single record so it is mostly a convenience to write the lookup and update in one command.
http://
summary: |
- Merge query support + SQL : Merge query support |
Changed in querydsl: | |
importance: | Undecided → Medium |
Changed in querydsl: | |
milestone: | none → 2.0 |
As the signature for returning the generated keys something like this?
SQLMergeClause{
List<Tuple> executeWithKeys();
}
I commited an implementation that works with H2. The UPDATE + INSERT combo for other engines follows soon.
Please comment here if the direction is ok.