我在安装 SQL Server 2008 时遇到此错误。我正在尝试将数据插入特定表中,但出现此错误。
ERROR - JDBCExceptionReporter - Implicit conversion from data type datetime to varbinary(max) is not allowed. Use the CONVERT function to run this query.
请注意,我在任何地方都没有 var 二进制列,我不知道为什么会遇到这个问题有人知道吗?
我没有 SQL 源代码,但我可以向您展示休眠映射
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="tester.model.TellerTotal" table="TELLER_TOTAL">
<id name="id" type="string">
<column name="ID" not-null="true" length="32"></column>
<generator class="uuid.hex"></generator>
</id>
<version name="version" type="java.lang.Integer">
<column name="VERSION" not-null="true" />
</version>
<property name="del" type="java.lang.Integer">
<column name="DEL" not-null="true" />
</property>
<property name="txnType" type="java.lang.Integer">
<column name="TRAN_TYPE" not-null="true" />
</property>
<property name="txnRefNo" type="string">
<column name="TRAN_REF_NO" not-null="false"/>
</property>
<many-to-one name="denomCcy" class="tester.model.Currency" fetch="select" insert="false" update="false" property-ref="cd">
<column name="DENOM_CCY" />
</many-to-one>
<property name="denomCcyCd" type="string">
<column name="DENOM_CCY" not-null="true" length="10" />
</property>
<property name="denom" type="java.math.BigDecimal">
<column name="DENOM" not-null="true" length="19" />
</property>
<property name="billType" type="java.lang.Integer">
<column name="BILL_TYPE" not-null="true" />
</property>
<property name="cashFlag" type="java.lang.Integer">
<column name="CASH_FLAG" not-null="true" />
</property>
<property name="totalDenomCnt" type="java.lang.Long">
<column name="TOT_DENOM_CNT" not-null="true" />
</property>
<many-to-one name="usr" class="tester.model.TestUsr" fetch="select" insert="false" update="false">
<column name="USER_CD" not-null="false" length="32" />
</many-to-one>
<property name="usrCd" type="string">
<column name="USER_CD" length="32" not-null="false"/>
</property>
<property name="ecFlag" type="java.lang.Integer">
<column name="EC_FLAG" not-null="true" />
</property>
<many-to-one name="branch" class="tester.model.Branch" fetch="select" insert="false" update="false" property-ref="cd">
<column name="BRANCH_CD" not-null="false" length="32" />
</many-to-one>
<property name="branchCd" type="string">
<column name="BRANCH_CD" length="32" not-null="false"/>
</property>
<property name="boxCd" type="string">
<column name="BOX_CD" length="32" not-null="false"/>
</property>
<property name="tranDt" type="java.util.Date">
<column name="TRAN_DT" not-null="false"/>
</property>
<property name="createDt" type="java.util.Date">
<column name="CREATE_DT" not-null="false"/>
</property>
</class>
</hibernate-mapping>
数据库结构
使用的脚本:SELECT COLUMN_NAME , DATA_TYPE AS DataType FROM INFORMATION_SCHEMA.Columns where TABLE_NAME = 'TELLER_TOTAL' ;
COLUMN_NAME DataType
-------------- -----------
ID varchar
VERSION int
DEL int
TRAN_TYPE int
TRAN_REF_NO varchar
DENOM_CCY varchar
DENOM money
BILL_TYPE int
DR_FLAG int
CASH_FLAG int
TOT_DENOM_CNT bigint
USER_CD varchar
ec_flag int
branch_cd varchar
box_cd varchar
CREATE_DT datetime
TRAN_DT datetime