File tree 2 files changed +14
-6
lines changed
orm/src/main/java/org/hibernate/tool/internal
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -85,12 +85,12 @@ public static void processBasicColumns(
85
85
if (JdbcToHibernateTypeHelper .typeHasLength (sqlType ) ) {
86
86
column .setLength (size );
87
87
}
88
- if (JdbcToHibernateTypeHelper .typeHasScaleAndPrecision (sqlType ) ) {
88
+ if (JdbcToHibernateTypeHelper .typeHasPrecision (sqlType ) ) {
89
89
column .setPrecision (size );
90
90
}
91
91
}
92
92
if (intBounds (decimalDigits ) ) {
93
- if (JdbcToHibernateTypeHelper .typeHasScaleAndPrecision (sqlType ) ) {
93
+ if (JdbcToHibernateTypeHelper .typeHasScale (sqlType ) ) {
94
94
column .setScale (decimalDigits );
95
95
}
96
96
}
Original file line number Diff line number Diff line change @@ -183,17 +183,25 @@ public static String getJDBCTypeName(int value) {
183
183
* @throws SQLException
184
184
*/
185
185
186
- // scale and precision have numeric column
187
- public static boolean typeHasScaleAndPrecision (int sqlType ) {
186
+ // scale is for non floating point numeric columns
187
+ public static boolean typeHasScale (int sqlType ) {
188
+ return (sqlType == Types .DECIMAL || sqlType == Types .NUMERIC );
189
+ }
190
+
191
+ // precision is for numeric columns
192
+ public static boolean typeHasPrecision (int sqlType ) {
188
193
return (sqlType == Types .DECIMAL || sqlType == Types .NUMERIC
189
194
|| sqlType == Types .REAL || sqlType == Types .FLOAT || sqlType == Types .DOUBLE );
190
195
}
196
+
197
+ public static boolean typeHasScaleAndPrecision (int sqlType ) {
198
+ return typeHasScale (sqlType ) && typeHasPrecision (sqlType );
199
+ }
191
200
192
- // length is for string column
201
+ // length is for string columns
193
202
public static boolean typeHasLength (int sqlType ) {
194
203
return (sqlType == Types .CHAR || sqlType == Types .DATE
195
204
|| sqlType == Types .LONGVARCHAR || sqlType == Types .TIME || sqlType == Types .TIMESTAMP
196
205
|| sqlType == Types .VARCHAR );
197
206
}
198
207
}
199
-
You can’t perform that action at this time.
0 commit comments