File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
orm/src/main/java/org/hibernate/tool/internal Expand file tree Collapse file tree 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(
8585 if (JdbcToHibernateTypeHelper .typeHasLength (sqlType ) ) {
8686 column .setLength (size );
8787 }
88- if (JdbcToHibernateTypeHelper .typeHasScaleAndPrecision (sqlType ) ) {
88+ if (JdbcToHibernateTypeHelper .typeHasPrecision (sqlType ) ) {
8989 column .setPrecision (size );
9090 }
9191 }
9292 if (intBounds (decimalDigits ) ) {
93- if (JdbcToHibernateTypeHelper .typeHasScaleAndPrecision (sqlType ) ) {
93+ if (JdbcToHibernateTypeHelper .typeHasScale (sqlType ) ) {
9494 column .setScale (decimalDigits );
9595 }
9696 }
Original file line number Diff line number Diff line change @@ -183,17 +183,25 @@ public static String getJDBCTypeName(int value) {
183183 * @throws SQLException
184184 */
185185
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 ) {
188193 return (sqlType == Types .DECIMAL || sqlType == Types .NUMERIC
189194 || sqlType == Types .REAL || sqlType == Types .FLOAT || sqlType == Types .DOUBLE );
190195 }
196+
197+ public static boolean typeHasScaleAndPrecision (int sqlType ) {
198+ return typeHasScale (sqlType ) && typeHasPrecision (sqlType );
199+ }
191200
192- // length is for string column
201+ // length is for string columns
193202 public static boolean typeHasLength (int sqlType ) {
194203 return (sqlType == Types .CHAR || sqlType == Types .DATE
195204 || sqlType == Types .LONGVARCHAR || sqlType == Types .TIME || sqlType == Types .TIMESTAMP
196205 || sqlType == Types .VARCHAR );
197206 }
198207}
199-
You can’t perform that action at this time.
0 commit comments