¡¾×ªÔØ¡¿Java/Hibernate/±ê×¼SQL Êý¾ÝÀàÐͶÔÓ¦±í
JavaÊý¾ÝÀàÐÍ
HibernateÊý¾ÝÀàÐÍ
±ê×¼SQLÊý¾ÝÀàÐÍ
(PS:¶ÔÓÚ²»Í¬µÄDB¿ÉÄÜÓÐËù²îÒì)
byte¡¢java.lang.Byte
byte
TINYINT
short¡¢java.lang.Short
short
SMALLINT
int¡¢java.lang.Integer
integer
INGEGER
long¡¢java.lang.Long
long
BIGINT
float¡¢java.lang.Float
float
FLOAT
double¡¢java.lang.Double
double
DOUBLE
java.math.BigDecimal
big_decimal
NUMERIC
char¡¢java.lang.Character
character
CHAR(1)
boolean¡¢java.lang.Boolean
boolean
BIT
java.lang.String
string
VARCHAR
boolean¡¢java.lang.Boolean
yes_no
CHAR(1)('Y'»ò'N')
boolean¡¢java.lang.Boolean
true_false
CHAR(1)('Y'»ò'N')
java.util.Date¡¢java.sql.Date
date
DATE
java.util.Date¡¢java.sql.Time
time
TIME
java.util.Date¡¢java.sql.Timestamp
timestamp
TIMESTAMP
java.util.Calendar
calendar
TIMESTAMP
java.util.Calendar
calendar_date
DATE
byte[]
binary
VARBINARY¡¢BLOB
java.lang.String
text
CLOB
java.io.Serializable
serializable
VARBINARY¡¢BLOB
java.sql.Clob
clob
CLOB
java.sql.Blob
blob
BLOB
java.lang.Class
class
VARCHAR
java.util.Locale
locale
VARCHAR
java.util.TimeZone
timezone
VARCHAR
java.util.Currency
currency
VARCHAR
Ïà¹ØÎĵµ£º
......
ÔÚSQL Server 2008ÖÐÒýÈëÁËhierarchyidÀ´´¦ÀíÊ÷×´½á¹¹¡£ÏÂÃæ¼òµ¥¾ÍÒÔAdventureWorks(ÎÞhierarchyid)ºÍAdventureWorks2008(ÓÐhierarchyid)ÀïµÄHumanResources.EmployeeΪÀý£¬À´ËµÃ÷Ò»ÏÂÔÚеÄhierarchyidÖÐÈçºÎ½øÐÐflat»¯µÄdimension³éÈ¡¡£
AdventureWorksÊÇ΢ÈíΪSQL ServerÌṩµÄÊý¾Ý¿âÐéÄâ°¸Àý¡£
AdventureWorksÖÐËùÒªµ ......
1¡£ÆóÒµ¹ÜÀíÆ÷
´ò¿ªÄ㽨ÓÐÍâ¼üµÄ±í££ÓÒ»÷±í££Éè¼Æ±í££ÔÚÉÏ·½µã¿ª’¹ÜÀíÔ¼Êø‘££½«¼¶Á¬É¾³ýºÍ¼¶Á¬¸üÐµĹµ´òÉϾͿÉÒÔÁË
2¡£²éѯ·ÖÎöÆ÷
alter table sc
add
constraint forei ......
2008Êý¾Ý¿â¸½¼Ó
/*
ÍøÉÏ¿´µ½µÄÕûÀíÁËһϡ£
ÔÎĵØÖ·http://database.51cto.com/art/201003/190984.htm
ÔÚSQL Server 7.0ÖУ¬Î¢ÈíÍƳöÁËsp_attach_dbºÍsp_attach_single_file_dbϵͳ´æ´¢¹ý³Ì¡£
Ëü¶ÔÓÚSQL ServerÊý¾Ý¿â¹ÜÀíÔ±Ö´ÐÐÏÂÃæµÄÈÎÎñÊǷdz£·½±ãµÄ£º
1 ʹÓÃsp_attach_d ......
µÚÒ»ÖÖ£º
SELECT
CASE
WHEN
price IS NULL THEN
'Not yet priced'
WHEN
price < 10 THEN
'Very Reasonable Title'
WHEN
price >= 10 AND
price < 20 THEN
'Coffee Table Title'
EL ......