diff --git a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/dialect/Dialect.java b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/dialect/Dialect.java index 2f4d45d07..7331c1219 100644 --- a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/dialect/Dialect.java +++ b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/dialect/Dialect.java @@ -1601,11 +1601,11 @@ public abstract class Dialect implements ConversionContext { * Build an instance of a {@link SQLExceptionConversionDelegate} for * interpreting dialect-specific error or SQLState codes. *

- * When {@link #buildSQLExceptionConverter} returns null, the default + * When {@link #buildSQLExceptionConverter} returns null, the default * {@link SQLExceptionConverter} is used to interpret SQLState and * error codes. If this method is overridden to return a non-null value, * the default {@link SQLExceptionConverter} will use the returned - * {@link SQLExceptionConversionDelegate} in addition to the following + * {@link SQLExceptionConversionDelegate} in addition to the following * standard delegates: *

    *
  1. a "static" delegate based on the JDBC 4 defined SQLException hierarchy;
  2. @@ -2783,4 +2783,12 @@ public abstract class Dialect implements ConversionContext { public boolean supportsNationalizedTypes() { return true; } + + /** + * 获取主键sql字符串 + * + * @param columnList 主键列集合 + * @return int + */ + public String getPrimaryKeyString(List columnList) { return "primary key";} } diff --git a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/mapping/PrimaryKey.java b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/mapping/PrimaryKey.java index 13a9693f2..4059b1474 100644 --- a/fine-hibernate/src/main/java/com/fr/third/org/hibernate/mapping/PrimaryKey.java +++ b/fine-hibernate/src/main/java/com/fr/third/org/hibernate/mapping/PrimaryKey.java @@ -6,6 +6,7 @@ */ package com.fr.third.org.hibernate.mapping; import java.util.Iterator; +import java.util.List; import com.fr.third.org.hibernate.dialect.Dialect; import com.fr.third.org.hibernate.internal.util.StringHelper; @@ -58,7 +59,8 @@ public class PrimaryKey extends Constraint { } public String sqlConstraintString(Dialect dialect) { - StringBuilder buf = new StringBuilder("primary key ("); + List columnList = getColumns(); + StringBuilder buf = new StringBuilder(dialect.getPrimaryKeyString(columnList)).append(" ("); Iterator iter = getColumnIterator(); while ( iter.hasNext() ) { buf.append( ( (Column) iter.next() ).getQuotedName(dialect) );