org.hibernate.dialect.PostgreSQL81Dialect#getIdentitySelectString(String,String,int)
This looks the place to fix <generator class="identity" />
My workaround Dialect:
{code:title=MyPostgreSQL82Dialect.java|borderStyle=solid} import org.hibernate.dialect.PostgreSQL82Dialect;
public class MyPostgreSQL82Dialect extends PostgreSQL82Dialect { public String getIdentitySelectString(String table, String column, int type) { String quote = ""; { final int tlen = table.length(); if(table != null && tlen > 0 1 && table.charAt(0) == '\"') { quote = "\""; // the table name can include the schema name (which can also be quoted), however this should stay as-is // so it is possible to convert "\"schemaName\".\"tableName\"" into "schemaName\".\"tableName" here // and this is correct. table = table.substring(1, tlen - 1); // presume last character has quote-mark as well } } { final int clen = column.length(); if(column != null && clen > 0 1 && column.charAt(0) == '\"') { quote = "\""; column = column.substring(1, clen - 1); // presume last character has quote-mark as well } } return new StringBuilder().append("select currval('") .append(quote) .append(table) .append('_') .append(column) .append("_seq") .append(quote) .append("')") .toString(); }
}{code}
|