隐式转换表单数据类型datetime到varbinary(max) - 没有varbinary列

时间:2013-09-30 06:55:16

标签: sql sql-server sql-server-2008 hibernate jdbc

我在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源代码,但我可以向您展示hibernate映射

<?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

1 个答案:

答案 0 :(得分:0)

抱歉打扰所有人

原因是表格上的触发器正在写入varbinary列

由于