private DbType getDbType(BeanProperty p) { ScalarType<?> scalarType = p.getScalarType(); if (scalarType == null) { throw new RuntimeException("No scalarType for " + p.getFullBeanName()); } if (p.isDbEncrypted()){ return dbTypeMap.get(p.getDbEncryptedType()); } int jdbcType = scalarType.getJdbcType(); if (p.isLob() && jdbcType == Types.VARCHAR){ // workaround for Postgres TEXT type which is // VARCHAR in jdbc API but TEXT in ddl jdbcType = Types.CLOB; } return dbTypeMap.get(jdbcType); } /**
private DbType getDbType(BeanProperty p) { ScalarType<?> scalarType = p.getScalarType(); if (scalarType == null) { throw new RuntimeException("No scalarType for " + p.getFullBeanName()); } if (p.isDbEncrypted()){ return dbTypeMap.get(p.getDbEncryptedType()); } int jdbcType = scalarType.getJdbcType(); if (p.isLob() && jdbcType == Types.VARCHAR){ // workaround for Postgres TEXT type which is // VARCHAR in jdbc API but TEXT in ddl jdbcType = Types.CLOB; } return dbTypeMap.get(jdbcType); } /**
public boolean visitBean(BeanDescriptor<?> descriptor) { wroteColumns.clear(); if (!descriptor.isInheritanceRoot()){ return false; } ctx.write("create table "); writeTableName(descriptor); ctx.write(" (").writeNewLine(); InheritInfo inheritInfo = descriptor.getInheritInfo(); if (inheritInfo != null && inheritInfo.isRoot()){ String discColumn = inheritInfo.getDiscriminatorColumn(); int discType = inheritInfo.getDiscriminatorType(); int discLength = inheritInfo.getDiscriminatorLength(); DbType dbType = ctx.getDbTypeMap().get(discType); String discDbType = dbType.renderType(discLength, 0); writeColumnName(discColumn, null); ctx.write(discDbType); ctx.write(" not null,"); ctx.writeNewLine(); } return true; }
public boolean visitBean(BeanDescriptor<?> descriptor) { wroteColumns.clear(); if (!descriptor.isInheritanceRoot()){ return false; } ctx.write("create table "); writeTableName(descriptor); ctx.write(" (").writeNewLine(); InheritInfo inheritInfo = descriptor.getInheritInfo(); if (inheritInfo != null && inheritInfo.isRoot()){ String discColumn = inheritInfo.getDiscriminatorColumn(); int discType = inheritInfo.getDiscriminatorType(); int discLength = inheritInfo.getDiscriminatorLength(); DbType dbType = ctx.getDbTypeMap().get(discType); String discDbType = dbType.renderType(discLength, 0); writeColumnName(discColumn, null); ctx.write(discDbType); ctx.write(" not null,"); ctx.writeNewLine(); } return true; }