使用 Hibernate 4,以下生成的查询失败:
delete from ErpEmploye_AUD where (code, folder_codeId, REV)
IN
(select code, folder_codeId, REV from HT_ErpEmploye_AUD where hib_sess_id=1)
火鸟例外:
SQL error code = -104
Token unknown - line 1, column 39
,
在org.hibernate.hql.spi.TableBasedDeleteHandlerImpl
课堂上有
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/hql/spi/TableBasedDeleteHandlerImpl.java
private String generateDelete(String tableName, String[] columnNames,
String idSubselect, String comment) {
final Delete delete = new Delete()
.setTableName( tableName )
.setWhere( "(" + StringHelper.join( ", ", columnNames ) +
") IN (" + idSubselect + ")" );
返回 delete.toStatementString(); }
所以我想使代码适应 Firebird,做同样工作的最接近的 Firebird 语法是什么?
我刚刚迁移到 Hibernate 4,似乎 Hibernate 4 中添加的临时表(以 HT_ ... 为前缀)的每次删除都是基于此方法,因此它看起来是一个重要问题。