public class HanaDialect extends AnsiSqlDialect
dbConfig, quoteWrapper| Constructor and Description |
|---|
HanaDialect(DbConfig config)
构造
|
| Modifier and Type | Method and Description |
|---|---|
String |
dialectName()
方言名
|
PreparedStatement |
psForUpsert(Connection conn,
Entity entity,
String... keys)
构建用于upsert的
PreparedStatement。 |
getWrapper, psForDelete, psForFind, psForInsert, psForInsertBatch, psForPage, psForPage, psForUpdate, setWrapper, wrapPageSqlclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpsForCount, psForCountpublic HanaDialect(DbConfig config)
config - 数据库配置对象public String dialectName()
DialectdialectName in interface DialectdialectName in class AnsiSqlDialectpublic PreparedStatement psForUpsert(Connection conn, Entity entity, String... keys) throws DbException
PreparedStatement。
SAP HANA 使用 MERGE INTO 语法来实现 UPSERT 操作。
生成 SQL 语法为:
MERGE INTO demo AS target
USING (SELECT ? AS a, ? AS b, ? AS c FROM DUMMY) AS source
ON target.id = source.id
WHEN MATCHED THEN
UPDATE SET target.a = source.a, target.b = source.b, target.c = source.c
WHEN NOT MATCHED THEN
INSERT (a, b, c) VALUES (source.a, source.b, source.c);
psForUpsert in interface DialectpsForUpsert in class AnsiSqlDialectconn - 数据库连接对象entity - 数据实体类(包含表名)keys - 主键字段数组,通常用于确定匹配条件(联合主键)DbException - SQL 执行异常Copyright © 2025. All rights reserved.