|
63 | 63 | import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor;
|
64 | 64 | import org.hibernate.exception.spi.ViolatedConstraintNameExtractor;
|
65 | 65 | import org.hibernate.internal.util.JdbcExceptionHelper;
|
| 66 | +import org.hibernate.mapping.AggregateColumn; |
66 | 67 | import org.hibernate.mapping.Column;
|
| 68 | +import org.hibernate.mapping.Table; |
67 | 69 | import org.hibernate.metamodel.mapping.EntityMappingType;
|
68 | 70 | import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
69 | 71 | import org.hibernate.procedure.internal.DB2CallableStatementSupport;
|
|
87 | 89 | import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorDB2DatabaseImpl;
|
88 | 90 | import org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorNoOpImpl;
|
89 | 91 | import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
|
| 92 | +import org.hibernate.tool.schema.internal.StandardTableExporter; |
| 93 | +import org.hibernate.tool.schema.spi.Exporter; |
90 | 94 | import org.hibernate.type.JavaObjectType;
|
91 | 95 | import org.hibernate.type.SqlTypes;
|
92 | 96 | import org.hibernate.type.StandardBasicTypes;
|
|
96 | 100 | import org.hibernate.type.descriptor.jdbc.CharJdbcType;
|
97 | 101 | import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
|
98 | 102 | import org.hibernate.type.descriptor.jdbc.InstantJdbcType;
|
| 103 | +import org.hibernate.type.descriptor.jdbc.JdbcType; |
99 | 104 | import org.hibernate.type.descriptor.jdbc.LocalDateJdbcType;
|
100 | 105 | import org.hibernate.type.descriptor.jdbc.LocalDateTimeJdbcType;
|
101 | 106 | import org.hibernate.type.descriptor.jdbc.LocalTimeJdbcType;
|
@@ -154,6 +159,17 @@ public class DB2LegacyDialect extends Dialect {
|
154 | 159 | ? LegacyDB2LimitHandler.INSTANCE
|
155 | 160 | : DB2LimitHandler.INSTANCE;
|
156 | 161 | private final UniqueDelegate uniqueDelegate = createUniqueDelegate();
|
| 162 | + private final StandardTableExporter db2TableExporter = new StandardTableExporter( this ) { |
| 163 | + @Override |
| 164 | + protected void applyAggregateColumnCheck(StringBuilder buf, AggregateColumn aggregateColumn) { |
| 165 | + final JdbcType jdbcType = aggregateColumn.getType().getJdbcType(); |
| 166 | + if ( jdbcType.isLob() || jdbcType.isXml() ) { |
| 167 | + // LOB or XML columns can't have check constraints |
| 168 | + return; |
| 169 | + } |
| 170 | + super.applyAggregateColumnCheck( buf, aggregateColumn ); |
| 171 | + } |
| 172 | + }; |
157 | 173 |
|
158 | 174 | public DB2LegacyDialect() {
|
159 | 175 | this( DatabaseVersion.make( 9, 0 ) );
|
@@ -189,6 +205,11 @@ public DatabaseVersion getDB2Version() {
|
189 | 205 | return this.getVersion();
|
190 | 206 | }
|
191 | 207 |
|
| 208 | + @Override |
| 209 | + public Exporter<Table> getTableExporter() { |
| 210 | + return this.db2TableExporter; |
| 211 | + } |
| 212 | + |
192 | 213 | @Override
|
193 | 214 | public int getDefaultStatementBatchSize() {
|
194 | 215 | return 0;
|
|
0 commit comments