HQL轉化SQL欄位大小寫問題

2022-05-07 17:06:14 字數 3094 閱讀 4083

實體層 supplierentity

public

class

supplierentity

//////

名稱

/// public

virtual

string name

//////

聯絡人

/// public

virtual

string linkman

//////

位址

/// public

virtual

string address

//////

**

/// public

virtual

string tel

//////

手機

/// public

virtual

string phone

//////

郵編

/// public

virtual

string postcode

//////

備註

/// public

virtual

string descr

}

supplierentity.hbm.xml

<?xml version="

1.0" encoding="

utf-8

" ?>

" assembly="

tbmanage.entity

"namespace="

tbmanage.entity

">

tbmanage.entity.supplierentity, tbmanage.entity

" table="

tsupplier

" lazy="

false

">

"supplierid

" column="

supplierid

" type="

int32

">

class="

native

" />

"name

" column="

name

" type="

string

" length="

50" not-null="

true

"/>

"linkman

" column="

linkman

" type="

string

" length="

50"/>

"address

" column="

address

" type="

string

" length="

50"/>

"phone

" column="

phone

" type="

string

" length="

50"/>

"postcode

" column="

postcode

" type="

string

" length="

50"/>

"descr

" column="

descr

" type="

string

" length="

200"/>

class>

資料庫表

set ansi_nulls on

goset quoted_identifier on

goset ansi_padding on

gocreate table [dbo].[tsupplier](

[supplierid] [

int] identity(1,1

) not null,

[name] [varchar](

50) null,

[linkman] [varchar](

50) null,

[address] [varchar](

100) null,

[tel] [varchar](

50) null,

[phone] [varchar](

50) null,

[postcode] [varchar](

50) null,

[descr] [varchar](

100) null,

[createuser] [varchar](

50) null,

[createdate] [date] null,

[updateuser] [varchar](

50) null,

[updatedate] [date] null,

constraint [pk_t_supplier] primary key clustered

( [supplierid] asc

)with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks =on) on [primary]

) on [primary]

goset ansi_padding off

go

ps:需要特別注意的是:在hbm.xml中,column中supplierid不可寫成supplierid,否則在hql轉換成sql時,會將supplierid轉換成supplier_id,如果資料庫欄位為supplier_id,在hbm.xml中,column中請寫為supplier_id。

hql轉化sql的時,會自動在第二個大寫字母之前新增「_」。

具體原因待查證!

sql大小寫問題

sql語句中的字母大小寫規則隨語句元素的不同而變化,同事還要取決於你正引用的事物和mysql伺服器主機上的作業系統。sql關鍵字和函式名 例 select now 關鍵字和函式名不區分字母的大小寫。資料庫 資料表和檢視的名字。在伺服器主機上,mysql資料庫和資料表用底層檔案系統中的目錄和檔案表示。...

flex大小寫轉化

publicfunctionconvertcurrency currencydigits string string if currencydigits.match d null if currencydigits match d d d,d d d null normalize the forma...

字母大小寫轉化

在通用宣告段中,宣告模組級變數x,如下 dim x as string private sub form load x text1.text end sub private sub command1 click text1.text ucase x end sub private sub comma...