문제

I want to insert some Java Double values some columns from a table(I am using SQL Server). How can I create the aforementioned table using Liquibase? More exact, what type should the column be? The attempt below is not working. Apparently Float is not precise enough for that.

<column name="visitsAvg" type="FLOAT"/>
도움이 되었습니까?

해결책 2

The issue was that I got NaN instead of a number. More exactly, at some point in my code there was a division by 0. Hence, the issue was not with converting Java Double to some SQL type, nor with Liquibase. I have wrongly assumed that the problem might lie there somewhere.

다른 팁

Liquibase uses the JDBC types for columns. The JDBC/SQL type FLOAT is not the same as the SQL Server type FLOAT. The JDBC type FLOAT is a 32 bit single precision floating point. You should specify DOUBLE if you want 64 bit double precision (FLOAT(53) in SQL Server).

Likely liquibase translates the request for type="FLOAT" to a column of type FLOAT(24) in SQL Server, which is insufficient to store a Java double with full precision.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top