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,而alenosqloptionslikemongodb,redis和calablesolutionsoluntionsoluntionsoluntionsolundortionsolunsolunsstructureddata.blobobobsimplobissimplobisslowderperformandperformanceperformancewithlararengelitiate;

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 lengengters lengengtings,varchar forbariaible lengength,varchariable length,andtext/blobforlabforlargerdata.2 seterters seterters seterters seterters


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

Dreamweaver Mac版
视觉化网页开发工具

Atom编辑器mac版下载
最流行的的开源编辑器

WebStorm Mac版
好用的JavaScript开发工具