<!DOCTYPE html>
<html lang="zh-Hans">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=5">
    <title>Hibernate的主键生成策略详解编程语言 | 云图网</title>
    <meta name="keywords" content="c,mysql,oracle,sqlserver,xml">
<meta name="description" content="在Hibernate中，javabean + hbm.xml 又称作persistent object，即PO 持久对象。持久化对象的唯一标识 为OID。 Java按地址区分同一个类的不同对象. 关系数据库用主键区分同一条记录 Hibernate使用OID来建立内存中的对象和数据库中记录的对应关系 对象的OID和数据库…">
<meta property="og:type" content="article">
<meta property="og:url" content="https://blog.ytso.com/tech/pnotes/12088.html">
<meta property="og:site_name" content="云图网">
<meta property="og:title" content="Hibernate的主键生成策略详解编程语言">
<meta property="og:description" content="在Hibernate中，javabean + hbm.xml 又称作persistent object，即PO 持久对象。持久化对象的唯一标识 为OID。 Java按地址区分同一个类的不同对象. 关系数据库用主键区分同一条记录 Hibernate使用OID来建立内存中的对象和数据库中记录的对应关系 对象的OID和数据库…">
<link rel="canonical" href="https://blog.ytso.com/tech/pnotes/12088.html">
<meta name="applicable-device" content="pc,mobile">
<meta http-equiv="Cache-Control" content="no-transform">
<link rel="shortcut icon" href="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg">
<link rel='dns-prefetch' href='//cdnjs.cloudflare.com' />
<style id='wp-img-auto-sizes-contain-inline-css' type='text/css'>
img:is([sizes=auto i],[sizes^="auto," i]){contain-intrinsic-size:3000px 1500px}
/*# sourceURL=wp-img-auto-sizes-contain-inline-css */
</style>
<link rel='stylesheet' id='stylesheet-css' href='https://blog.ytso.com/wp-content/themes/justnews/css/style.css?ver=6.21.5' type='text/css' media='all' />
<link rel='stylesheet' id='material-icons-css' href='https://blog.ytso.com/wp-content/themes/justnews/themer/assets/css/material-icons.css?ver=6.21.5' type='text/css' media='all' />
<link rel='stylesheet' id='remixicon-css' href='https://cdnjs.cloudflare.com/ajax/libs/remixicon/4.2.0/remixicon.min.css?ver=6.9.4' type='text/css' media='all' />
<link rel='stylesheet' id='font-awesome-css' href='https://blog.ytso.com/wp-content/themes/justnews/themer/assets/css/font-awesome.css?ver=6.21.5' type='text/css' media='all' />
<style id='wp-block-library-inline-css' type='text/css'>
:root{--wp-block-synced-color:#7a00df;--wp-block-synced-color--rgb:122,0,223;--wp-bound-block-color:var(--wp-block-synced-color);--wp-editor-canvas-background:#ddd;--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,160.5;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.wp-element-button{cursor:pointer}:root .has-very-light-gray-background-color{background-color:#eee}:root .has-very-dark-gray-background-color{background-color:#313131}:root .has-very-light-gray-color{color:#eee}:root .has-very-dark-gray-color{color:#313131}:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(135deg,#00d084,#0693e3)}:root .has-purple-crush-gradient-background{background:linear-gradient(135deg,#34e2e4,#4721fb 50%,#ab1dfe)}:root .has-hazy-dawn-gradient-background{background:linear-gradient(135deg,#faaca8,#dad0ec)}:root .has-subdued-olive-gradient-background{background:linear-gradient(135deg,#fafae1,#67a671)}:root .has-atomic-cream-gradient-background{background:linear-gradient(135deg,#fdd79a,#004a59)}:root .has-nightshade-gradient-background{background:linear-gradient(135deg,#330968,#31cdcf)}:root .has-midnight-gradient-background{background:linear-gradient(135deg,#020381,#2874fc)}:root{--wp--preset--font-size--normal:16px;--wp--preset--font-size--huge:42px}.has-regular-font-size{font-size:1em}.has-larger-font-size{font-size:2.625em}.has-normal-font-size{font-size:var(--wp--preset--font-size--normal)}.has-huge-font-size{font-size:var(--wp--preset--font-size--huge)}.has-text-align-center{text-align:center}.has-text-align-left{text-align:left}.has-text-align-right{text-align:right}.has-fit-text{white-space:nowrap!important}#end-resizable-editor-section{display:none}.aligncenter{clear:both}.items-justified-left{justify-content:flex-start}.items-justified-center{justify-content:center}.items-justified-right{justify-content:flex-end}.items-justified-space-between{justify-content:space-between}.screen-reader-text{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.screen-reader-text:focus{background-color:#ddd;clip-path:none;color:#444;display:block;font-size:1em;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}html :where(.has-border-color){border-style:solid}html :where([style*=border-top-color]){border-top-style:solid}html :where([style*=border-right-color]){border-right-style:solid}html :where([style*=border-bottom-color]){border-bottom-style:solid}html :where([style*=border-left-color]){border-left-style:solid}html :where([style*=border-width]){border-style:solid}html :where([style*=border-top-width]){border-top-style:solid}html :where([style*=border-right-width]){border-right-style:solid}html :where([style*=border-bottom-width]){border-bottom-style:solid}html :where([style*=border-left-width]){border-left-style:solid}html :where(img[class*=wp-image-]){height:auto;max-width:100%}:where(figure){margin:0 0 1em}html :where(.is-position-sticky){--wp-admin--admin-bar--position-offset:var(--wp-admin--admin-bar--height,0px)}@media screen and (max-width:600px){html :where(.is-position-sticky){--wp-admin--admin-bar--position-offset:0px}}
/*wp_block_styles_on_demand_placeholder:69c87c1847646*/
/*# sourceURL=wp-block-library-inline-css */
</style>
<style id='classic-theme-styles-inline-css' type='text/css'>
/*! This file is auto-generated */
.wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none}
/*# sourceURL=/wp-includes/css/classic-themes.min.css */
</style>
<link rel='stylesheet' id='wpcom-member-css' href='https://blog.ytso.com/wp-content/plugins/wpcom-member/css/style.css?ver=1.7.19' type='text/css' media='all' />
<script type="text/javascript" src="https://blog.ytso.com/wp-includes/js/jquery/jquery.min.js?ver=3.7.1" id="jquery-core-js"></script>
<script type="text/javascript" src="https://blog.ytso.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.4.1" id="jquery-migrate-js"></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://blog.ytso.com/xmlrpc.php?rsd" />
<meta name='description' content='在Hibernate中，javabean + hbm.xml 又称作persistent object，即PO 持久对象。持久化对象的唯一标识 为OID。 Java按地址区分同一个类的不同对象. 关系数据库用主键区分同一条记录 Hibernate使用OID来建立内存中的…' />
<meta name='keywords' content='c,mysql,oracle,sqlserver,xml' />
<style>:root{--theme-color: #08c; --theme-hover: #07c; --logo-height: 32px; --logo-height-mobile: 26px; --menu-item-gap: 28px; --member-login-bg: url('https://blog.ytso.com/loginwall.jpg'); --header-bg-color: #fff; --header-bg-image: none; --theme-border-radius-s: 3px; --theme-border-radius-m: 5px; --theme-border-radius-l: 8px; --theme-border-radius-xl: 12px; --thumb-ratio-default: 480 / 300; --thumb-ratio-post: 480 / 300; --post-video-ratio: 860 / 482;}</style>
<link rel="icon" href="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg" sizes="32x32" />
<link rel="icon" href="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg" sizes="192x192" />
<link rel="apple-touch-icon" href="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg" />
<meta name="msapplication-TileImage" content="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg" />
    <!--[if lte IE 11]><script src="https://blog.ytso.com/wp-content/themes/justnews/js/update.js"></script><![endif]-->
</head>
<body class="wp-singular post-template-default single single-post postid-12088 single-format-standard wp-theme-justnews lang-cn el-boxed header-fixed">
<header class="header header-fluid">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse" aria-label="menu">
                <span class="icon-bar icon-bar-1"></span>
                <span class="icon-bar icon-bar-2"></span>
                <span class="icon-bar icon-bar-3"></span>
            </button>
                        <div class="logo">
                <a href="https://blog.ytso.com/" rel="home">
                    <img src="https://imgcdn.ytso.com/wp-content/uploads/2021/12/20211207181156143.png" alt="云图网">
                </a>
            </div>
        </div>
        <div class="collapse navbar-collapse mobile-style-0">
            <nav class="primary-menu"><ul id="menu-justnews-footer-menu" class="nav navbar-nav wpcom-adv-menu"><li class="menu-item"><a href="https://blog.ytso.com/category/industrynews">业界资讯</a></li>
<li class="menu-item current-post-ancestor active menu-item-style menu-item-style-1 dropdown"><a target="_blank" href="https://blog.ytso.com/category/tech" class="dropdown-toggle">技术专区</a>
<ul class="dropdown-menu menu-item-wrap menu-item-col-5">
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/cloud">云计算</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/ai">人工智能</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/safety">信息安全</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/bigdata">大数据</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/dev">研发管理</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/webdev">大前端</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/opensource">开源</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/aiops">智能运维</a></li>
	<li class="menu-item current-post-ancestor current-post-parent active"><a href="https://blog.ytso.com/category/tech/pnotes">编程笔记</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/wp">WordPress</a></li>
</ul>
</li>
<li class="menu-item"><a href="https://blog.ytso.com/category/enterprise-strategic-planning">企业战略规划</a></li>
<li class="menu-item"><a href="https://blog.ytso.com/category/download">下载专区</a></li>
<li class="menu-item"><a href="https://blog.ytso.com/category/it%e6%b1%9f%e6%b9%96%e5%8f%b2">江湖史</a></li>
<li class="menu-item"><a href="https://blog.ytso.com/category/notes">随笔记录</a></li>
</ul></nav>            <div class="navbar-action">
                <div class="navbar-search-icon j-navbar-search"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-search"></use></svg></i></div><form class="navbar-search" action="https://blog.ytso.com/" method="get" role="search"><div class="navbar-search-inner"><i class="wpcom-icon wi navbar-search-close"><svg aria-hidden="true"><use xlink:href="#wi-close"></use></svg></i><input type="text" name="s" class="navbar-search-input" autocomplete="off" maxlength="100" placeholder="输入关键词搜索..." value=""><button class="navbar-search-btn" type="submit" aria-label="搜索"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-search"></use></svg></i></button></div></form>                    <div id="j-user-wrap">
                        <a class="login" href="https://blog.ytso.com/login">登录</a>
                        <a class="login register" href="https://blog.ytso.com/register">注册</a>
                    </div>
                                            <a class="wpcom-btn btn-primary btn-xs publish" href="https://blog.ytso.com/contribute">
                            <i class="fa fa-edit"></i> 投稿                        </a>
                                </div>
        </div>
    </div><!-- /.container -->
</header>

<div id="wrap">    <div class="wrap container">
        <ol class="breadcrumb" vocab="https://schema.org/" typeof="BreadcrumbList"><li class="home" property="itemListElement" typeof="ListItem"><a href="https://blog.ytso.com" property="item" typeof="WebPage"><span property="name" class="hide">云图网</span>首页</a><meta property="position" content="1"></li><li property="itemListElement" typeof="ListItem"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-right-3"></use></svg></i><a href="https://blog.ytso.com/category/tech" property="item" typeof="WebPage"><span property="name">技术专区</span></a><meta property="position" content="2"></li><li property="itemListElement" typeof="ListItem"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-right-3"></use></svg></i><a href="https://blog.ytso.com/category/tech/pnotes" property="item" typeof="WebPage"><span property="name">编程笔记</span></a><meta property="position" content="3"></li></ol>        <main class="main">
                            <article id="post-12088" class="post-12088 post type-post status-publish format-standard hentry category-pnotes tag-c tag-mysql tag-oracle tag-sqlserver tag-xml entry">
                    <div class="entry-main">
                                                                        <div class="entry-head">
                            <h1 class="entry-title">Hibernate的主键生成策略详解编程语言</h1>
                            <div class="entry-info">
                                                                <time class="entry-date published" datetime="2021-07-19T14:19:08+08:00" pubdate>
                                    2021年7月19日 14:19                                </time>
                                <span class="dot">•</span>
                                <a href="https://blog.ytso.com/category/tech/pnotes" rel="category tag">编程笔记</a>                                                            </div>
                        </div>
                        
                                                <div class="entry-content text-indent text-justify">
                            <p>在Hibernate中，javabean + hbm.xml 又称作persistent object，即PO 持久对象。持久化对象的唯一标识 为OID。</p>
<p>Java按地址区分同一个类的不同对象. <br /> 关系数据库用主键区分同一条记录 <br /> Hibernate使用OID来建立内存中的对象和数据库中记录的对应关系 <br /> 对象的OID和数据库的表的主键对应。为保证OID的唯一性，应该让Hibernate来为OID付值,hibernate 通过主键生成策略对OID进行赋值</p>
<p>Hibernate的主键分类 <br /> 代理主键：Hibernate负责生成 <br /> 自然主键：程序自己生成</p>
<p>hbm配置文件中的配置：</p>
<pre class="prism-language-java"><span class="hljs-pi">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span> 
<span class="hljs-doctype">&lt;!DOCTYPE hibernate-mapping PUBLIC  
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"&gt;</span> 
<span class="hljs-tag">&lt;<span class="hljs-title">hibernate-mapping</span> <span class="hljs-attribute">package</span>=<span class="hljs-value">"com.my.bean"</span> &gt;</span> 
    <span class="hljs-tag">&lt;<span class="hljs-title">class</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">"User"</span> <span class="hljs-attribute">table</span>=<span class="hljs-value">"t_user"</span>&gt;</span> 
        <span class="hljs-tag">&lt;<span class="hljs-title">id</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">"id"</span>&gt;</span> 
            <span class="hljs-comment">&lt;!-- hibernate的主键生成策略 --&gt;</span> 
            <span class="hljs-tag">&lt;<span class="hljs-title">generator</span> <span class="hljs-attribute">class</span>=<span class="hljs-value">"native"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">generator</span>&gt;</span> 
        <span class="hljs-tag">&lt;/<span class="hljs-title">id</span>&gt;</span> 
        <span class="hljs-tag">&lt;<span class="hljs-title">property</span> <span class="hljs-attribute">name</span>=<span class="hljs-value">"username"</span> &gt;</span><span class="hljs-tag">&lt;/<span class="hljs-title">property</span>&gt;</span> 
    <span class="hljs-tag">&lt;/<span class="hljs-title">class</span>&gt;</span> 
 
<span class="hljs-tag">&lt;/<span class="hljs-title">hibernate-mapping</span>&gt;</span></pre>
<p>id：设定持久化类的 OID 和表的主键的映射 <br /> name: 标识持久化类 OID 的属性名 <br /> column: 设置标识属性所映射的数据列的列名(主键字段的名字). <br /> unsaved-value:若设定了该属性, Hibernate 会通过比较持久化类的 OID 值和该属性值来区分当前持久化类的对象是否为临时对象,在Hibernate3中几乎不再需要. <br /> type:指定 Hibernate 映射类型. Hibernate 映射类型是 Java 类型与 SQL 类型的桥梁. 如果没有为某个属性显式设定映射类型, Hibernate 会运用反射机制先识别出持久化类的特定属性的 Java 类型, 然后自动使用与之对应的默认的 Hibernate 映射类型 <br /> Java 的基本数据类型和包装类型对应相同的 Hibernate 映射类型. 基本数据类型无法表达 null, 所以对于持久化类的 OID 推荐使用包装类型（integer，long，string等）</p>
<p>generator：设定持久化类设定标识符生成器 <br /> class: 指定使用的标识符生成器全限定类名或其缩写名</p>
<p>主键生成策略:</p>
<table>
<thead>
<tr>
<th>表示符生成器</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>increment</td>
<td>适用于代理主键。由hibernate自动以递增的方式生成表识符，每次增量为1</td>
</tr>
<tr>
<td>identity</td>
<td>适用于代理主键。由底层数据库生成表识符。条件是数据库支持自动增长数据类型。</td>
</tr>
<tr>
<td>sequence</td>
<td>适用于代理主键。Hibernate根据底层数据库序列生成标识符。条件是数据库支持序列。</td>
</tr>
<tr>
<td>hilo</td>
<td>适用于代理主键。Hibernate根据hign/low算法生成标识符。Hibernate把特定表的字段作为“hign”值。默认情况下，采用hibernate_unique_key表的next_hi字段。</td>
</tr>
<tr>
<td>native</td>
<td>适用于代理主键。根据底层数据库对自动生成表示符的能力来选择identity、sequence、hilo</td>
</tr>
<tr>
<td>uuid</td>
<td>适用于代理主键。Hibernate采用128位的UUID算法来生成标识符。该算法能够在网络环境中生成唯一的字符串标识符，这种策略并不流行，因为字符串类型的主键比整数类型的主键占用更多的数据库空间。</td>
</tr>
<tr>
<td>assigned</td>
<td>适用于自然主键。由java程序负责生成标识符。不能把setID()方法声明为Private的。尽量避免使用自然主键。</td>
</tr>
</tbody>
</table>
<hr>
<p>increment 标识符生成器: 代理主键 <br /> increment 标识符生成器由 Hibernate 以递增的方式为代理主键赋值 <br /> Hibernate 会先读取表中的主键的最大值, 而接下来向表中插入记录时, 就在 max(id) 的基础上递增, 增量为 1. <br /> 适用范围: <br /> 由于 increment 生存标识符机制不依赖于底层数据库系统, 因此它适合所有的数据库系统 <br /> 适用于只有单个 Hibernate 应用进程访问同一个数据库的场合 <br /> OID 必须为 long, int 或 short 类型, 如果把 OID 定义为 byte 类型, 在运行时会抛出异常 <br /> 缺陷：存在线程并发问题</p>
<p>identity 标识符生成器: 代理主键 <br /> identity 标识符生成器由底层数据库来负责生成标识符, 它要求底层数据库把主键定义为自动增长字段类型（加1带走） <br /> 适用范围: <br /> 由于 identity 生成标识符的机制依赖于底层数据库系统, 因此, 要求底层数据库系统必须支持自动增长字段类型. 支持自动增长字段类型的数据库包括: DB2, Mysql, MSSQLServer, Sybase 等 <br /> OID 必须为 long, int 或 short 类型, 如果把 OID 定义为 byte 类型, 在运行时会抛出异常</p>
<p>sequence 标识符生成器: 代理主键 <br /> sequence 标识符生成器利用底层数据库提供的序列来生成标识符 <br /> Hibernate 在持久化一个 News 对象时, 先从底层数据库的 news_seq 序列中获得一个唯一的标识号, 再把它作为主键值 <br /> 适用范围: <br /> 由于 sequence 生成标识符的机制依赖于底层数据库系统的序列, 因此, 要求底层数据库系统必须支持序列. 支持序列的数据库包括: DB2 Oracle 等 <br /> OID 必须为 long, int 或 short 类型, 如果把 OID 定义为 byte 类型, 在运行时会抛出异常</p>
<p>hilo 标识符生成器：代理主键 <br /> hilo 高低位算法生成器， 使用高低位算法维护数据唯一。不依赖于数据库。将在数据库中创建一个用于标识数据库的表。 <br /> 适用范围: <br /> 数据库不支持identity和sequence两种生成器时</p>
<p>native 标识符生成器：代理主键 <br /> native 标识符生成器依据底层数据库对自动生成标识符的支持能力, 来选择使用 identity, sequence 或 hilo 标识符生成器. <br /> 适用范围: <br /> 由于 native 能根据底层数据库系统的类型, 自动选择合适的标识符生成器, 因此很适合于跨数据库平台开发 <br /> OID 必须为 long, int 或 short 类型, 如果把 OID 定义为 byte 类型, 在运行时会抛出异常</p>
<p>assigned 标识符生成器：自然主键 <br /> 映射单个自然主键，UUID ，id(身份证)</p>
<p>uuid 32位标识符生成器：代理主键 <br /> 自动生成UUID值 <br /> Hibernate会产生不重复的32位字符串作为主键</p>
<div class="entry-readmore"><div class="entry-readmore-btn"></div></div>                                                        <div class="entry-copyright"><p>原创文章，作者：Maggie-Hunter，如若转载，请注明出处：https://blog.ytso.com/tech/pnotes/12088.html</p></div>                        </div>

                        <div class="entry-tag"><a href="https://blog.ytso.com/tag/c" rel="tag">c</a><a href="https://blog.ytso.com/tag/mysql" rel="tag">mysql</a><a href="https://blog.ytso.com/tag/oracle" rel="tag">oracle</a><a href="https://blog.ytso.com/tag/sqlserver" rel="tag">sqlserver</a><a href="https://blog.ytso.com/tag/xml" rel="tag">xml</a></div>
                        <div class="entry-action">
                            <div class="btn-zan" data-id="12088"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-thumb-up-fill"></use></svg></i> 赞 <span class="entry-action-num">(0)</span></div>
                                                    </div>

                        <div class="entry-bar">
                            <div class="entry-bar-inner">
                                                                <div class="entry-bar-info entry-bar-info2">
                                    <div class="info-item meta">
                                                                                    <a class="meta-item j-heart" href="javascript:;" data-id="12088"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-star"></use></svg></i> <span class="data">0</span></a>                                        <a class="meta-item" href="#comments"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-comment"></use></svg></i> <span class="data">0</span></a>                                                                            </div>
                                    <div class="info-item share">
                                                                                    <a class="meta-item mobile j-mobile-share" href="javascript:;" data-id="12088" data-qrcode="https://blog.ytso.com/tech/pnotes/12088.html">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-share"></use></svg></i> 生成海报                                            </a>
                                                                                    <a class="meta-item wechat" data-share="wechat" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-wechat"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item weibo" data-share="weibo" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-weibo"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item qq" data-share="qq" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-qq"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item qzone" data-share="qzone" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-qzone"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item douban" data-share="douban" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-douban"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item linkedin" data-share="linkedin" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-linkedin"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item facebook" data-share="facebook" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-facebook"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item twitter" data-share="twitter" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-twitter"></use></svg></i>                                            </a>
                                                                            </div>
                                    <div class="info-item act">
                                        <a href="javascript:;" id="j-reading"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-article"></use></svg></i></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                                            <div class="entry-page">
                    <div class="entry-page-prev j-lazy" style="background-image: url('https://blog.ytso.com/wp-content/themes/justnews/themer/assets/images/lazy.png');" data-original="http://ytso-blog-oss-img.oss-cn-beijing.aliyuncs.com/wp-content/uploads/2021/07/19/20210719_60f53ed4a68be.png">
                <a href="https://blog.ytso.com/tech/pnotes/12087.html" title="Hibernate关联关系映射---1对多详解编程语言" rel="prev">
                    <span>Hibernate关联关系映射---1对多详解编程语言</span>
                </a>
                <div class="entry-page-info">
                    <span class="pull-left"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-left-double"></use></svg></i> 上一篇</span>
                    <span class="pull-right">2021年7月19日 14:19</span>
                </div>
            </div>
                            <div class="entry-page-next j-lazy" style="background-image: url('https://blog.ytso.com/wp-content/themes/justnews/themer/assets/images/lazy.png');" data-original="http://ytso-blog-oss-img.oss-cn-beijing.aliyuncs.com/wp-content/uploads/2021/07/19/20210719_60f53ed66a6a3.png">
                <a href="https://blog.ytso.com/tech/pnotes/12089.html" title="Hibernate中的配置文件常用配置介绍详解编程语言" rel="next">
                    <span>Hibernate中的配置文件常用配置介绍详解编程语言</span>
                </a>
                <div class="entry-page-info">
                    <span class="pull-right">下一篇 <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-right-double"></use></svg></i></span>
                    <span class="pull-left">2021年7月19日 14:19</span>
                </div>
            </div>
            </div>
                                        <error>
    <code>wp_die</code>
    <title><![CDATA[WordPress &amp;rsaquo; Error]]></title>
    <message><![CDATA[&lt;h1&gt;Error establishing a Redis connection&lt;/h1&gt;
&lt;p&gt;To disable Redis, delete the &lt;code&gt;object-cache.php&lt;/code&gt; file in the &lt;code&gt;/wp-content/&lt;/code&gt; directory.&lt;/p&gt;
]]></message>
    <data>
        <status>500</status>
    </data>
</error>
<!--
Performance optimized by Redis Object Cache. Learn more: https://wprediscache.com

Retrieved 2149 objects (411 KB) from Redis using Predis (v2.4.0).
-->
