Skip to content

Commit bdc0070

Browse files
cigalygavinking
authored andcommitted
HHH-18446 Added default SQL type code to LongVarbinaryJdbcType abd LongVarcharJdbcType
1 parent b5b1957 commit bdc0070

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,19 @@
1414
public class LongVarbinaryJdbcType extends VarbinaryJdbcType {
1515
public static final LongVarbinaryJdbcType INSTANCE = new LongVarbinaryJdbcType();
1616

17-
private final int jdbcTypeCode;
17+
private final int defaultSqlTypeCode;
1818

1919
public LongVarbinaryJdbcType() {
20-
this(Types.LONGVARBINARY);
20+
this( Types.LONGVARBINARY );
2121
}
2222

23-
public LongVarbinaryJdbcType(int jdbcTypeCode) {
24-
this.jdbcTypeCode = jdbcTypeCode;
23+
public LongVarbinaryJdbcType(int defaultSqlTypeCode) {
24+
this.defaultSqlTypeCode = defaultSqlTypeCode;
25+
}
26+
27+
@Override
28+
public int getDefaultSqlTypeCode() {
29+
return defaultSqlTypeCode;
2530
}
2631

2732
@Override
@@ -31,6 +36,6 @@ public String toString() {
3136

3237
@Override
3338
public int getJdbcTypeCode() {
34-
return jdbcTypeCode;
39+
return Types.LONGVARBINARY;
3540
}
3641
}

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
*/
55
package org.hibernate.type.descriptor.jdbc;
66

7-
import java.sql.Types;
8-
97
import org.hibernate.type.SqlTypes;
108
import org.hibernate.type.descriptor.java.JavaType;
119
import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry;
1210
import org.hibernate.type.spi.TypeConfiguration;
1311

12+
import java.sql.Types;
13+
1414
/**
1515
* Descriptor for {@link Types#LONGVARCHAR LONGVARCHAR} handling.
1616
*
@@ -19,14 +19,14 @@
1919
public class LongVarcharJdbcType extends VarcharJdbcType {
2020
public static final LongVarcharJdbcType INSTANCE = new LongVarcharJdbcType();
2121

22-
private final int jdbcTypeCode;
22+
private final int defaultSqlTypeCode;
2323

2424
public LongVarcharJdbcType() {
25-
this(Types.LONGVARCHAR);
25+
this( Types.LONGVARCHAR );
2626
}
2727

28-
public LongVarcharJdbcType(int jdbcTypeCode) {
29-
this.jdbcTypeCode = jdbcTypeCode;
28+
public LongVarcharJdbcType(int defaultSqlTypeCode) {
29+
this.defaultSqlTypeCode = defaultSqlTypeCode;
3030
}
3131

3232
@Override
@@ -36,7 +36,12 @@ public String toString() {
3636

3737
@Override
3838
public int getJdbcTypeCode() {
39-
return jdbcTypeCode;
39+
return Types.LONGVARCHAR;
40+
}
41+
42+
@Override
43+
public int getDefaultSqlTypeCode() {
44+
return defaultSqlTypeCode;
4045
}
4146

4247
@Override

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.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.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.LONG32NVARCHAR) );
105105

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

0 commit comments

Comments
 (0)