关于hibernate对sqlserver中表做count操作时的错误
表结构
/*==============================================================*/
/* Table: customer_unit_info */
/*==============================================================*/
create table customer_unit_info (
customer_unit_id numeric identity,
unit_id integer null,
card_number varchar(20) not null,
customer_unit_name varchar(70) not null,
customer_unit_manager varchar(12) null,
customer_unit_bank_name varchar(50) not null,
customer_unit_bank_code varchar(30) not null,
customer_unit_address varchar(70) null,
customer_unit_phone varchar(20) null,
customer_unit_phone2 varchar(20) null,
customer_unit_postcode varchar(8) null,
customer_unit_fax varchar(20) null,
constraint PK_CUSTOMER_UNIT_INFO primary key (customer_unit_id)
)
go
对应的hbm文件内容
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- Created Mon Oct 18 17:26:30 CST 2004 -->
<hibernate-mapping package="com.bkgd.water.dao.tables">
<class name="CustomerUnitInfo" table="customer_unit_info">
<id name="customerUnitId" column="customer_unit_id" type="java.lang.Long">
<generator class="identity"/>
</id>
<property name="unitId" column="unit_id" type="java.lang.Integer" />
<property name="cardNumber" column="card_number" type="java.lang.String" not-null="true" />
<property name="customerUnitName" column="customer_unit_name" type="java.lang.String" not-null="true" />
<property name="customerUnitManager" column="customer_unit_manager" type="java.lang.String" />
<property name="customerUnitBankName" column="customer_unit_bank_name" type="java.lang.String" not-null="true" />
<property name="customerUnitBankCode" column="customer_unit_bank_code" type="java.lang.String" not-null="true" />
<property name="customerUnitAddress" column="customer_unit_address" type="java.lang.String" />
<property name="customerUnitPhone" column="customer_unit_phone" type="java.lang.String" />
<property name="customerUnitPhone2" column="customer_unit_phone2" type="java.lang.String" />
<property name="customerUnitPostcode" column="customer_unit_postcode" type="java.lang.String" />
<property name="customerUnitFax" column="customer_unit_fax" type="java.lang.String" />
</class>
</hibernate-mapping>