|
42 | 42 | import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor;
|
43 | 43 | import org.hibernate.exception.spi.ViolatedConstraintNameExtractor;
|
44 | 44 | import org.hibernate.internal.util.JdbcExceptionHelper;
|
| 45 | +import org.hibernate.mapping.Column; |
45 | 46 | import org.hibernate.mapping.ForeignKey;
|
| 47 | +import org.hibernate.mapping.PrimaryKey; |
| 48 | +import org.hibernate.mapping.Table; |
| 49 | +import org.hibernate.mapping.UniqueKey; |
46 | 50 | import org.hibernate.metamodel.mapping.EntityMappingType;
|
47 | 51 | import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
48 | 52 | import org.hibernate.query.spi.QueryOptions;
|
|
70 | 74 | import org.hibernate.sql.exec.spi.JdbcOperation;
|
71 | 75 | import org.hibernate.tool.schema.extract.spi.SequenceInformationExtractor;
|
72 | 76 | import org.hibernate.tool.schema.internal.StandardForeignKeyExporter;
|
| 77 | +import org.hibernate.tool.schema.internal.StandardTableExporter; |
73 | 78 | import org.hibernate.tool.schema.spi.Exporter;
|
74 | 79 | import org.hibernate.type.descriptor.jdbc.ClobJdbcType;
|
75 | 80 | import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
|
@@ -137,6 +142,30 @@ public String[] getSqlCreateStrings(
|
137 | 142 | return results;
|
138 | 143 | }
|
139 | 144 | };
|
| 145 | + private final StandardTableExporter informixTableExporter = new StandardTableExporter( this ) { |
| 146 | + @Override |
| 147 | + protected String primaryKeyString(PrimaryKey key) { |
| 148 | + final StringBuilder constraint = new StringBuilder(); |
| 149 | + constraint.append( "primary key (" ); |
| 150 | + boolean first = true; |
| 151 | + for ( Column column : key.getColumns() ) { |
| 152 | + if ( first ) { |
| 153 | + first = false; |
| 154 | + } |
| 155 | + else { |
| 156 | + constraint.append(", "); |
| 157 | + } |
| 158 | + constraint.append( column.getQuotedName( dialect ) ); |
| 159 | + } |
| 160 | + constraint.append(')'); |
| 161 | + final UniqueKey orderingUniqueKey = key.getOrderingUniqueKey(); |
| 162 | + if ( orderingUniqueKey != null && orderingUniqueKey.isNameExplicit() ) { |
| 163 | + constraint.append( " constraint " ) |
| 164 | + .append( orderingUniqueKey.getName() ).append( ' ' ); |
| 165 | + } |
| 166 | + return constraint.toString(); |
| 167 | + } |
| 168 | + }; |
140 | 169 |
|
141 | 170 | public InformixDialect(DialectResolutionInfo info) {
|
142 | 171 | this( info.makeCopyOrDefault( DEFAULT_VERSION ) );
|
@@ -662,6 +691,11 @@ public IdentityColumnSupport getIdentityColumnSupport() {
|
662 | 691 | return InformixIdentityColumnSupport.INSTANCE;
|
663 | 692 | }
|
664 | 693 |
|
| 694 | + @Override |
| 695 | + public Exporter<Table> getTableExporter() { |
| 696 | + return this.informixTableExporter; |
| 697 | + } |
| 698 | + |
665 | 699 | @Override
|
666 | 700 | public void appendBooleanValueString(SqlAppender appender, boolean bool) {
|
667 | 701 | appender.appendSql( bool ? "'t'" : "'f'" );
|
|
0 commit comments