Home > Database > Mysql Tutorial > body text

Mysql生成UUID的操作_MySQL

WBOY
Release: 2016-06-01 13:36:40
Original
2657 people have browsed it

bitsCN.com


Mysql生成UUID的操作

 

Hibernate中这样配置主键生成后,mysql中并未指定主键生成机制,

使用Navicat通过sql语句insert数据时仍需指定Id,  

 

Java代码  

INSERT INTO g_distinct VALUES ( replace(uuid(),'-',''),'110101','东城区','110100');  

 

Java代码   

@Id  

@GenericGenerator(name = "generator", strategy = "uuid.hex")  

@GeneratedValue(generator = "generator")  

@Column(name = "LOCATION_ID", length = 40)  

public String getLocationId() {  

    return locationId;  

}  

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!