http://blog.sina.com.cn/s/blog_5f240fc40100etlt.html 一、记录下hibernate mysql映射类型对应表: 1.常规Hibernate 映射 integer 或者 int int 或者 java.lang.Integer INTEGER 4 字节 long long Long BIGINT 8 字节 short short Short SMALLINT 2 字节 b
http://blog.sina.com.cn/s/blog_5f240fc40100etlt.html
一、记录下hibernate mysql映射类型对应表:
1.常规Hibernate 映射
integer 或者 int |
int 或者 java.lang.Integer |
INTEGER |
4 字节 |
long |
long |
BIGINT |
8 字节 |
short |
short |
SMALLINT |
2 字节 |
byte |
byte |
TINYINT |
1 字节 |
float |
float |
FLOAT |
4 字节 |
double |
double |
DOUBLE |
8 字节 |
big_decimal |
java.math.BigDecimal |
NUMERIC |
NUMERIC(8,2)8 位 |
character |
char |
CHAR(1) |
定长字符 |
string |
String |
VARCHAR |
变长字符串 |
boolean |
boolean |
BIT |
布尔类型 |
yes_no |
boolean |
CHAR(1) (Y-N) |
布尔类型 |
true_false |
boolean |
CHAR(1) (T-F) |
布尔类型 |
2 、 Java 时间和日期类型的 Hibernate 映射
映射类型 |
Java 类型 |
标准 SQL 类型 |
描述 |
date |
util.Date 或者 sql.Date |
DATE |
YYYY-MM-DD |
time |
Date |
TIME |
HH:MM:SS |
timestamp |
Date |
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实例时,必须包含两个步骤:
1.在一个数据库事务中先保存一个空的 Blob 或 Clob 实例。
2.接着锁定这条记录,更新上面保存的 Blob 或 Clob 实例,把二进制数据或文本数据写到 Blob 或 Clob实例中
二、mysql数据库导入导出
1.导出整个数据库:
mysqldump -u 用户名 -p 数据库名 > 导出的文件名
如:
在mysql的bin目录里面执行如下命令
C:\MySQL\MySQL Server 5.0\bin>mysqldump -u root -ptestdb > testdb.sql
Enter password:
C:\MySQL\MySQL Server 5.0\bin>
2.导出表
格式:mysqldump -u 用户名 -p 数据库名 表名> 导出的文件名
举例:表结构与上面的相同,命令如下:
C:\MySQL\MySQL Server 5.0\bin>mysqldump -u root -ptestdb user > user.sql
Enter password:
C:\MySQL\MySQL Server 5.0\bin>
3.导入数据库
mysql> use testdb;
Database changed
mysql> source testdb.sql;
ALTER TABLE lanke_news DROP COLUMN script_id;

mysqlviewshavelimitations:1)他們不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinsOrsubqueries.2)他們canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

porthusermanagementinmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)複雜的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

通過PHP網頁界面添加MySQL用戶可以使用MySQLi擴展。步驟如下:1.連接MySQL數據庫,使用MySQLi擴展。 2.創建用戶,使用CREATEUSER語句,並使用PASSWORD()函數加密密碼。 3.防止SQL注入,使用mysqli_real_escape_string()函數處理用戶輸入。 4.為新用戶分配權限,使用GRANT語句。

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而ilenosqloptionslikemongodb,redis和calablesolutionsolutionsolutionsoluntionsoluntionsolundortionsolunsonstructureddata.blobobobissimplobisslowdeperformberbutslowderformandperformancewithlararengedata;

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollationsEttingSefectery.1)usecharforfixed lengengtrings,varchar forvariable-varchar forbariaible length,andtext/blobforlargerdataa.2 seterters seterters seterters


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

WebStorm Mac版
好用的JavaScript開發工具

mPDF
mPDF是一個PHP庫,可以從UTF-8編碼的HTML產生PDF檔案。原作者Ian Back編寫mPDF以從他的網站上「即時」輸出PDF文件,並處理不同的語言。與原始腳本如HTML2FPDF相比,它的速度較慢,並且在使用Unicode字體時產生的檔案較大,但支援CSS樣式等,並進行了大量增強。支援幾乎所有語言,包括RTL(阿拉伯語和希伯來語)和CJK(中日韓)。支援嵌套的區塊級元素(如P、DIV),

MantisBT
Mantis是一個易於部署的基於Web的缺陷追蹤工具,用於幫助產品缺陷追蹤。它需要PHP、MySQL和一個Web伺服器。請查看我們的演示和託管服務。

SublimeText3漢化版
中文版,非常好用

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境