hibernate mysqlÓ³ÉäÀàÐÍ
integer »òÕß int
int »òÕß java.lang.Integer
INTEGER
4 ×Ö½Ú
long
long Long
BIGINT
8 ×Ö½Ú
short
short Short
SMALLINT
2 ×Ö½Ú
byte
byte Byte
TINYINT
1 ×Ö½Ú
float
float Float
FLOAT
4 ×Ö½Ú
double
double Double
DOUBLE
8 ×Ö½Ú
big_decimal
java.math.BigDecimal
NUMERIC
NUMERIC(8,2)8 λ
character
char Character String
CHAR(1)
¶¨³¤×Ö·û
string
String
VARCHAR
±ä³¤×Ö·û´®
boolean
boolean Boolean
BIT
²¼¶ûÀàÐÍ
yes_no
boolean Boolean
CHAR(1) (Y-N)
²¼¶ûÀàÐÍ
true_false
boolean Boolean
CHAR(1) (T-F)
²¼¶ûÀàÐÍ
2 ¡¢ Java ʱ¼äºÍÈÕÆÚÀàÐ굀 Hibernate Ó³Éä
Ó³ÉäÀàÐÍ
Java ÀàÐÍ
±ê×¼ SQL ÀàÐÍ
ÃèÊö
date
util.Date »òÕß sql.Date
DATE
YYYY-MM-DD
time
Date Time
TIME
HH:MM:SS
timestamp
Date Timestamp
TIMESTAMP
YYYYMMDDHHMMSS
calendar
calendar
TIMESTAMP
YYYYMMDDHHMMSS
calendar_date
calendar
DATE
YYYY-MM-DD
3 ¡¢ Java ´ó¶ÔÏóÀàÐ굀 Hibernate Ó³ÉäÀàÐÍ
Ó³ÉäÀàÐÍ
Java ÀàÐÍ
±ê×¼ SQL ÀàÐÍ
MySQL ÀàÐÍ
Oracle ÀàÐÍ
binary
byte[]
VARBINARY( »ò BLOB)
BLOB
BLOB
text
String
CLOB
TEXT
CLOB
serializable
Serializable ½Ó¿ÚÈÎÒâʵÏÖÀà
VARBINARY( »ò BLOB)
BLOB
BLOB
clob
java.sql.Clob
CLOB
TEXT
CLOB
blob
java.sql.Blob
BLOB
BLOB
BLOB
ÔÚ³ÌÐòÖÐͨ¹ý Hibernate À´±£´æ java.sql.Clob »òÕß java.sql.Blob ʵÀýʱ£¬±ØÐë°üº¬Á½¸ö²½Ö裺
l ÔÚÒ»¸öÊý¾Ý¿âÊÂÎñÖÐÏȱ£´æÒ»¸ö¿ÕµÄ Blob »ò Clob ʵÀý¡£
l ½Ó×ÅËø¶¨ÕâÌõ¼Ç¼£¬¸üÐÂÉÏÃæ±£´æµÄ Blob »ò Clob ʵÀý£¬°Ñ¶þ½øÖÆÊý¾Ý»òÎı¾Êý¾Ýдµ½ Blob »ò Clob ʵÀýÖÐ
Ïà¹ØÎĵµ£º
1. Mysql Åàѵ
1.1. ÅàѵĿµÄ
±¾ÎĵµÊÇÕë¶ÔMySQL Êý¾Ý¿â·½ÃæµÄ»ù´¡Åàѵ£¬ÎªÁËʹÏîÄ¿×é³ÉÔ±Äܹ»´ïµ½Ê¹ÓÃMySQL Êý¾Ý¿âµÄÄ¿µÄ¡£
1.2. Åàѵ¶ÔÏó
¿ª·¢ÈËÔ±
1.3. ³£Óôʼ°·ûºÅ˵Ã÷
³£Óôʣº
Mysql£ºÒ»ÖÖÃâ·ÑµÄ¿çƽ̨µÄÊý¾Ý¿âϵͳ
E:\mysql£º±íʾÊÇÔÚdos ÃüÁî´°¿ÚÏÂÃæ
mysql> ±íʾÊÇÔÚmysql µÄÃüÁîÐÐÏÂ
1.4 ......
1016´íÎó£ºÎļþÎÞ·¨´ò¿ª£¬Ê¹Óúǫ́ÐÞ¸´»òÕßʹÓÃphpmyadmin½øÐÐÐÞ¸´¡£
1044´íÎó£ºÊý¾Ý¿âÓû§È¨ÏÞ²»×㣬ÇëÁªÏµ¿Õ¼äÉ̽â¾ö
1045´íÎó£ºÊý¾Ý¿â·þÎñÆ÷/Êý¾Ý¿âÓû§Ãû/Êý¾Ý¿âÃû/Êý¾Ý¿âÃÜÂë´íÎó£¬ÇëÁªÏµ¿Õ¼äÉ̼ì²éÕÊ»§¡£
1054´íÎ󣺳ÌÐòÎļþ¸úÊý¾Ý¿âÓгåÍ»£¬ÇëʹÓÃÕýÈ·µÄ³ÌÐòÎļþÉÏ´«ÉÏÈ¥¸²¸Ç¡£
1146´íÎó£ºÊý¾Ý±íȱʧ,Çë»Ö ......
¼Ù¶¨±ítbl_name¾ßÓÐÒ»¸öPRIMARY KEY»òUNIQUEË÷Òý£¬±¸·ÝÒ»¸öÊý¾Ý±íµÄ¹ý³ÌÈçÏ£º
1¡¢Ëø¶¨Êý¾Ý±í£¬±ÜÃâÔÚ±¸·Ý¹ý³ÌÖУ¬±í±»¸üÐÂ
mysql>LOCK
TABLES READ tbl_name;
¹ØÓÚ±íµÄËø¶¨µÄÏêϸÐÅÏ¢£¬½«ÔÚÏÂÒ»Õ½éÉÜ¡£
2¡¢µ¼³öÊý¾Ý
mysql>SELECT
* INTO OUTFILE ‘tbl_name.bak’ from tbl_name;
3¡¢½âË ......
ÈçºÎµ¼Èë.sqlÎļþµ½mysqlÖУ¿
C:\mysql\bin>mysql -u Óû§Ãû -p Êý¾Ý¿âÃû < c:/test.sql (source "c:\adsense.sql" )
ÖмäµÄ¿Õ¸ñÊÇÒ»¸ö¿Õ¸ñλ¡£
ͬʱʹÓÃ200¶àMBµÄsqlÎļþ¡£
ÀýÈ磺
C:\Program Files\MySQL\bin>mysql -u root -p myrosz & ......
¡¡1.µ¼³öÕû¸öÊý¾Ý¿â
¡¡¡¡mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû > µ¼³öµÄÎļþÃû
¡¡¡¡mysqldump -u wcnc -p smgp_apps_wcnc > wcnc.sql
¡¡¡¡2.µ¼³öÒ»¸ö±í
¡¡¡¡mysqldump -u Óû§Ãû -p Êý¾Ý¿âÃû ±íÃû> µ¼³öµÄÎļþÃû
¡¡¡¡mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
¡¡¡¡3.µ¼³öÒ»¸öÊý¾Ý¿â½á¹¹
¡ ......