Skip to content

Commit 89f5eb3

Browse files
committed
HHH-18446 Added default SQL type code to LongVarbinaryJdbcType abd LongVarcharJdbcType
1 parent f3f154b commit 89f5eb3

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongVarbinaryJdbcType.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,24 @@ public class LongVarbinaryJdbcType extends VarbinaryJdbcType {
1616

1717
private final int jdbcTypeCode;
1818

19+
private final int defaultSqlTypeCode;
20+
1921
public LongVarbinaryJdbcType() {
2022
this(Types.LONGVARBINARY);
2123
}
2224

2325
public LongVarbinaryJdbcType(int jdbcTypeCode) {
26+
this( jdbcTypeCode, jdbcTypeCode );
27+
}
28+
29+
public LongVarbinaryJdbcType(final int jdbcTypeCode, final int defaultSqlTypeCode) {
2430
this.jdbcTypeCode = jdbcTypeCode;
31+
this.defaultSqlTypeCode = defaultSqlTypeCode;
32+
}
33+
34+
@Override
35+
public int getDefaultSqlTypeCode() {
36+
return defaultSqlTypeCode;
2537
}
2638

2739
@Override

hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/LongVarcharJdbcType.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ public class LongVarcharJdbcType extends VarcharJdbcType {
2121

2222
private final int jdbcTypeCode;
2323

24+
private final int defaultSqlTypeCode;
25+
2426
public LongVarcharJdbcType() {
2527
this(Types.LONGVARCHAR);
2628
}
2729

2830
public LongVarcharJdbcType(int jdbcTypeCode) {
31+
this( jdbcTypeCode, jdbcTypeCode );
32+
}
33+
34+
public LongVarcharJdbcType(final int jdbcTypeCode, final int defaultSqlTypeCode) {
2935
this.jdbcTypeCode = jdbcTypeCode;
36+
this.defaultSqlTypeCode = defaultSqlTypeCode;
3037
}
3138

3239
@Override
@@ -39,6 +46,11 @@ public int getJdbcTypeCode() {
3946
return jdbcTypeCode;
4047
}
4148

49+
@Override
50+
public int getDefaultSqlTypeCode() {
51+
return defaultSqlTypeCode;
52+
}
53+
4254
@Override
4355
public JdbcType resolveIndicatedType(
4456
JdbcTypeIndicators indicators,

hibernate-core/src/main/java/org/hibernate/type/descriptor/jdbc/internal/JdbcTypeBaseline.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ public static void prime(BaselineTarget target) {
8585
target.addDescriptor( BinaryJdbcType.INSTANCE );
8686
target.addDescriptor( VarbinaryJdbcType.INSTANCE );
8787
target.addDescriptor( LongVarbinaryJdbcType.INSTANCE );
88-
target.addDescriptor( new LongVarbinaryJdbcType(SqlTypes.LONG32VARBINARY) );
88+
target.addDescriptor( new LongVarbinaryJdbcType(SqlTypes.LONGVARBINARY, SqlTypes.LONG32VARBINARY) );
8989

9090
target.addDescriptor( CharJdbcType.INSTANCE );
9191
target.addDescriptor( VarcharJdbcType.INSTANCE );
9292
target.addDescriptor( LongVarcharJdbcType.INSTANCE );
93-
target.addDescriptor( new LongVarcharJdbcType(SqlTypes.LONG32VARCHAR) );
93+
target.addDescriptor( new LongVarcharJdbcType(SqlTypes.LONGVARCHAR, SqlTypes.LONG32VARCHAR) );
9494

9595
target.addDescriptor( BlobJdbcType.DEFAULT );
9696
target.addDescriptor( ClobJdbcType.DEFAULT );
@@ -101,7 +101,7 @@ public static void prime(BaselineTarget target) {
101101
target.addDescriptor( Types.NVARCHAR, VarcharJdbcType.INSTANCE );
102102
target.addDescriptor( Types.LONGNVARCHAR, LongVarcharJdbcType.INSTANCE );
103103
target.addDescriptor( Types.NCLOB, ClobJdbcType.DEFAULT );
104-
target.addDescriptor( new LongVarcharJdbcType(SqlTypes.LONG32NVARCHAR) );
104+
target.addDescriptor( new LongVarcharJdbcType(SqlTypes.LONGVARCHAR, SqlTypes.LONG32NVARCHAR) );
105105

106106
target.addDescriptor( RowIdJdbcType.INSTANCE );
107107
}

0 commit comments

Comments
 (0)