<span style="color:rgb(102,102,102); font-family:Helvetica,Tahoma,Arial,sans-serif; font-size:14px; line-height:25px">一、JPA通用策略生成器 <br>
通过annotation来映射hibernate实体的,基于annotation的hibernate主键标识为@Id, <br>
其生成规则由@GeneratedValue设定的.这里的@id和@GeneratedValue都是JPA的标准用法, <br>
JPA提供四种标准用法,由@GeneratedValue的源代码可以明显看出. <br>
<br>
</span>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Target</span><span style="color:black">({METHOD,FIELD})    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    <span class="annotation" style="color:rgb(100,100,100)">@Retention</span><span style="color:black">(RUNTIME)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">@interface</span><span style="color:black"> GeneratedValue{    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">        GenerationType strategy() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> AUTO;    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">        String generator() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="string" style="color:blue">""</span><span style="color:black">;    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    }   </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
其中GenerationType: <br>
<br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">enum</span><span style="color:black"> GenerationType{    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    TABLE,    </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    SEQUENCE,    </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    IDENTITY,    </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    AUTO   </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">}  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
JPA提供的四种标准用法为TABLE,SEQUENCE,IDENTITY,AUTO. <br>
TABLE:使用一个特定的数据库表格来保存主键。 <br>
SEQUENCE:根据底层数据库的序列来生成主键,条件是数据库支持序列。 <br>
IDENTITY:主键由数据库自动生成(主要是自动增长型) <br>
AUTO:主键由程序控制。 <br>
<br>
1、TABLE <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Id</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(strategy = GenerationType.TABLE, generator=</span><span class="string" style="color:blue">"payablemoney_gen"</span><span style="color:black">)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@TableGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"pk_gen"</span><span style="color:black">,  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    table=<span class="string" style="color:blue">"tb_generator"</span><span style="color:black">,  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    pkColumnName=<span class="string" style="color:blue">"gen_name"</span><span style="color:black">,  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    valueColumnName=<span class="string" style="color:blue">"gen_value"</span><span style="color:black">,  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    pkColumnValue=<span class="string" style="color:blue">"PAYABLEMOENY_PK"</span><span style="color:black">,  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    allocationSize=<span class="number" style="color:rgb(192,0,0)">1</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">)  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
这里应用表tb_generator,定义为 <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Sql代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-sql" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">CREATE</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">TABLE</span><span style="color:black">  tb_generator (  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  id NUMBER <span class="op" style="color:rgb(128,128,128)">NOT</span><span style="color:black"> </span><span class="op" style="color:rgb(128,128,128)">NULL</span><span style="color:black">,  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  gen_name VARCHAR2(255) <span class="op" style="color:rgb(128,128,128)">NOT</span><span style="color:black"> </span><span class="op" style="color:rgb(128,128,128)">NULL</span><span style="color:black">,  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  gen_value NUMBER <span class="op" style="color:rgb(128,128,128)">NOT</span><span style="color:black"> </span><span class="op" style="color:rgb(128,128,128)">NULL</span><span style="color:black">,  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">PRIMARY</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">KEY</span><span style="color:black">(id)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">)  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
插入纪录,供生成主键使用, <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Sql代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-sql" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">INSERT</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">INTO</span><span style="color:black"> tb_generator(id, gen_name, gen_value) </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">VALUES</span><span style="color:black"> (1,PAYABLEMOENY_PK', 1);  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
在主键生成后,这条纪录的value值,按allocationSize递增。 <br>
<br>
<br>
@TableGenerator的定义: <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Target</span><span style="color:black">({TYPE, METHOD, FIELD})   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Retention</span><span style="color:black">(RUNTIME)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">@interface</span><span style="color:black"> TableGenerator {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  String name();  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  String table() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="string" style="color:blue">""</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  String catalog() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="string" style="color:blue">""</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  String schema() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="string" style="color:blue">""</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  String pkColumnName() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="string" style="color:blue">""</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  String valueColumnName() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="string" style="color:blue">""</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  String pkColumnValue() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="string" style="color:blue">""</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">int</span><span style="color:black"> initialValue() </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="number" style="color:rgb(192,0,0)">0</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">int</span><span style="color:black"> allocationSize() </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="number" style="color:rgb(192,0,0)">50</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  UniqueConstraint[] uniqueConstraints() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> {};  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">}  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
其中属性说明: <br>
name属性表示该表主键生成策略的名称,它被引用在@GeneratedValue中设置的“generator”值中。 <br>
table属性表示表生成策略所持久化的表名,例如,这里表使用的是数据库中的“tb_generator”。 <br>
catalog属性和schema具体指定表所在的目录名或是数据库名。 <br>
pkColumnName属性的值表示在持久化表中,该主键生成策略所对应键值的名称。例如在“tb_generator”中将“gen_name”作为主键的键值 <br>
valueColumnName属性的值表示在持久化表中,该主键当前所生成的值,它的值将会随着每次创建累加。例如,在“tb_generator”中将“gen_value”作为主键的值 <br>
pkColumnValue属性的值表示在持久化表中,该生成策略所对应的主键。例如在“tb_generator”表中,将“gen_name”的值为“CUSTOMER_PK”。 <br>
initialValue表示主键初识值,默认为0。 <br>
allocationSize表示每次主键值增加的大小,例如设置成1,则表示每次创建新记录后自动加1,默认为50。 <br>
UniqueConstraint与@Table标记中的用法类似。 <br>
<br>
2、SEQUENCE <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Id</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(strategy = GenerationType.SEQUENCE,generator=</span><span class="string" style="color:blue">"payablemoney_seq"</span><span style="color:black">)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@SequenceGenerator</span><span style="color:black">(name=</span><span class="string" style="color:blue">"payablemoney_seq"</span><span style="color:black">, sequenceName=</span><span class="string" style="color:blue">"seq_payment"</span><span style="color:black">)  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
@SequenceGenerator定义 <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Target</span><span style="color:black">({TYPE, METHOD, FIELD})   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Retention</span><span style="color:black">(RUNTIME)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">@interface</span><span style="color:black"> SequenceGenerator {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> String name();  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> String sequenceName() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="string" style="color:blue">""</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">int</span><span style="color:black"> initialValue() </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="number" style="color:rgb(192,0,0)">0</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">int</span><span style="color:black"> allocationSize() </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> </span><span class="number" style="color:rgb(192,0,0)">50</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">}  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
name属性表示该表主键生成策略的名称,它被引用在@GeneratedValue中设置的“generator”值中。 <br>
sequenceName属性表示生成策略用到的数据库序列名称。 <br>
initialValue表示主键初识值,默认为0。 <br>
allocationSize表示每次主键值增加的大小,例如设置成1,则表示每次创建新记录后自动加1,默认为50。 <br>
<br>
<br>
3、IDENTITY <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Id</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(strategy = GenerationType.IDENTITY)  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
4、AUTO <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Id</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(strategy = GenerationType.AUTO)  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
在指定主键时,如果不指定主键生成策略,默认为AUTO。 <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Id</span><span style="color:black">  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
跟下面的定义是一样的。 <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Id</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(strategy = GenerationType.AUTO)  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
二、hibernate主键策略生成器 <br>
hibernate提供多种主键生成策略,有点是类似于JPA,有的是hibernate特有: <br>
native: 对于 oracle 采用 Sequence 方式,对于MySQL 和 SQL Server 采用identity(自增主键生成机制),native就是将主键的生成工作交由数据库完成,hibernate不管(很常用)。 <br>
uuid: 采用128位的uuid算法生成主键,uuid被编码为一个32位16进制数字的字符串。占用空间大(字符串类型)。 <br>
hilo: 使用hilo生成策略,要在数据库中建立一张额外的表,默认表名为hibernate_unique_key,默认字段为integer类型,名称是next_hi(比较少用)。 <br>
assigned: 在插入数据的时候主键由程序处理(很常用),这是 <generator>元素没有指定时的默认生成策略。等同于JPA中的AUTO。 <br>
identity: 使用SQL Server 和 MySQL 的自增字段,这个方法不能放到 Oracle 中,Oracle 不支持自增字段,要设定sequence(MySQL 和 SQL Server 中很常用)。 <br>等同于JPA中的INDENTITY。 <br>
select: 使用触发器生成主键(主要用于早期的数据库主键生成机制,少用)。 <br>
sequence: 调用底层数据库的序列来生成主键,要设定序列名,不然hibernate无法找到。 <br>
seqhilo: 通过hilo算法实现,但是主键历史保存在Sequence中,适用于支持 Sequence 的数据库,如 Oracle(比较少用) <br>
increment: 插入数据的时候hibernate会给主键添加一个自增的主键,但是一个hibernate实例就维护一个计数器,所以在多个实例运行的时候不能使用这个方法。 <br>
foreign: 使用另外一个相关联的对象的主键。通常和<one-to-one>联合起来使用。 <br>
guid: 采用数据库底层的guid算法机制,对应MYSQL的uuid()函数,SQL Server的newid()函数,ORACLE的rawtohex(sys_guid())函数等。 <br>
uuid.hex: 看uuid,建议用uuid替换。 <br>
sequence-identity: sequence策略的扩展,采用立即检索策略来获取sequence值,需要JDBC3.0和JDK4以上(含1.4)版本 <br>
<br>
hibernate提供了多种生成器供选择,基于Annotation的方式通过@GenericGenerator实现. <br>
hibernate每种主键生成策略提供接口org.hibernate.id.IdentifierGenerator的实现类,如果要实现自定义的主键生成策略也必须实现此接口. <br>
<br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">interface</span><span style="color:black"> IdentifierGenerator {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    <span class="comment" style="color:rgb(0,130,0)">/**</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">     * The configuration parameter holding the entity name</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">     */</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">static</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">final</span><span style="color:black"> String ENTITY_NAME = </span><span class="string" style="color:blue">"entity_name"</span><span style="color:black">;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">      </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="comment" style="color:rgb(0,130,0)">/**</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">   * Generate a new identifier.</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">   * @param session</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">   * @param object the entity or toplevel collection for which the id is being generated</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">   *</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">   * @return a new identifier</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">   * @throws HibernateException</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">   */</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> Serializable generate(SessionImplementor session, Object object)   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">throws</span><span style="color:black"> HibernateException;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">}  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
IdentifierGenerator提供一generate方法,generate方法返回产生的主键. <br>
<br>
<br>
三、@GenericGenerator <br>
自定义主键生成策略,由@GenericGenerator实现。 <br>
hibernate在JPA的基础上进行了扩展,可以用一下方式引入hibernate独有的主键生成策略,就是通过@GenericGenerator加入的。 <br>
<br>
比如说,JPA标准用法 <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Id</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(GenerationType.AUTO)  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
就可以用hibernate特有以下用法来实现 <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"assigned"</span><span style="color:black">)  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
@GenericGenerator的定义: <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Target</span><span style="color:black">({PACKAGE, TYPE, METHOD, FIELD})  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Retention</span><span style="color:black">(RUNTIME)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">@interface</span><span style="color:black"> GenericGenerator {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> <span class="comment" style="color:rgb(0,130,0)">/**</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">  * unique generator name</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">  */</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> String name();  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> <span class="comment" style="color:rgb(0,130,0)">/**</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">  * Generator strategy either a predefined Hibernate</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">  * strategy or a fully qualified class name.</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">  */</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> String strategy();  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> <span class="comment" style="color:rgb(0,130,0)">/**</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">  * Optional generator parameters</span> </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="comment" style="color:rgb(0,130,0)">  */</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> Parameter[] parameters() <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">default</span><span style="color:black"> {};  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">}  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
name属性指定生成器名称。 <br>
strategy属性指定具体生成器的类名。 <br>
parameters得到strategy指定的具体生成器所用到的参数。 <br>
<br>
对于这些hibernate主键生成策略和各自的具体生成器之间的关系,在org.hibernate.id.IdentifierGeneratorFactory中指定了, <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">static</span><span style="color:black"> {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"uuid"</span><span style="color:black">, UUIDHexGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"hilo"</span><span style="color:black">, TableHiLoGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"assigned"</span><span style="color:black">, Assigned.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"identity"</span><span style="color:black">, IdentityGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"select"</span><span style="color:black">, SelectGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"sequence"</span><span style="color:black">, SequenceGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"seqhilo"</span><span style="color:black">, SequenceHiLoGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"increment"</span><span style="color:black">, IncrementGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"foreign"</span><span style="color:black">, ForeignGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"guid"</span><span style="color:black">, GUIDGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"uuid.hex"</span><span style="color:black">, UUIDHexGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">); </span><span class="comment" style="color:rgb(0,130,0)">//uuid.hex is deprecated</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  GENERATORS.put(<span class="string" style="color:blue">"sequence-identity"</span><span style="color:black">, SequenceIdentityGenerator.</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">}  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
上面十二种策略,加上native,hibernate一共默认支持十三种生成策略。 <br>
<br>
1、native <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"native"</span><span style="color:black">)   </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
2、uuid <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"uuid"</span><span style="color:black">)   </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
3、hilo <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"hilo"</span><span style="color:black">)   </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
4、assigned <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"assigned"</span><span style="color:black">)   </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
5、identity <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"identity"</span><span style="color:black">)   </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
6、select <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name=</span><span class="string" style="color:blue">"select"</span><span style="color:black">, strategy=</span><span class="string" style="color:blue">"select"</span><span style="color:black">,  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">     parameters = { <span class="annotation" style="color:rgb(100,100,100)">@Parameter</span><span style="color:black">(name = </span><span class="string" style="color:blue">"key"</span><span style="color:black">, value = </span><span class="string" style="color:blue">"idstoerung"</span><span style="color:black">) })  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
7、sequence <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"sequence"</span><span style="color:black">,   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">         parameters = { <span class="annotation" style="color:rgb(100,100,100)">@Parameter</span><span style="color:black">(name = </span><span class="string" style="color:blue">"sequence"</span><span style="color:black">, value = </span><span class="string" style="color:blue">"seq_payablemoney"</span><span style="color:black">) })  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
8、seqhilo <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"seqhilo"</span><span style="color:black">,   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">         parameters = { <span class="annotation" style="color:rgb(100,100,100)">@Parameter</span><span style="color:black">(name = </span><span class="string" style="color:blue">"max_lo"</span><span style="color:black">, value = </span><span class="string" style="color:blue">"5"</span><span style="color:black">) })  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
9、increment <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"increment"</span><span style="color:black">)   </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
10、foreign <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"idGenerator"</span><span style="color:black">)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"idGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"foreign"</span><span style="color:black">,   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">         parameters = { <span class="annotation" style="color:rgb(100,100,100)">@Parameter</span><span style="color:black">(name = </span><span class="string" style="color:blue">"property"</span><span style="color:black">, value = </span><span class="string" style="color:blue">"employee"</span><span style="color:black">) })  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
注意:直接使用@PrimaryKeyJoinColumn 报错(?) <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@OneToOne</span><span style="color:black">(cascade = CascadeType.ALL)   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@PrimaryKeyJoinColumn</span><span style="color:black">   </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
例如 <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Entity</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black"> Employee {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="annotation" style="color:rgb(100,100,100)">@Id</span><span style="color:black"> Integer id;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">      </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="annotation" style="color:rgb(100,100,100)">@OneToOne</span><span style="color:black"> </span><span class="annotation" style="color:rgb(100,100,100)">@PrimaryKeyJoinColumn</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  EmployeeInfo info;  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  ...  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">}  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
应该为 <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@Entity</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black"> Employee {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="annotation" style="color:rgb(100,100,100)">@Id</span><span style="color:black">   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"idGenerator"</span><span style="color:black">)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"idGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"foreign"</span><span style="color:black">,   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">         parameters = { <span class="annotation" style="color:rgb(100,100,100)">@Parameter</span><span style="color:black">(name = </span><span class="string" style="color:blue">"property"</span><span style="color:black">, value = </span><span class="string" style="color:blue">"info"</span><span style="color:black">) })   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  Integer id;  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">      </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="annotation" style="color:rgb(100,100,100)">@OneToOne</span><span style="color:black">  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  EmployeeInfo info;  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  ...  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">}  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
11、guid <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"guid"</span><span style="color:black">)   </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
12、uuid.hex <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"uuid.hex"</span><span style="color:black">)   </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
13、sequence-identity <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"sequence-identity"</span><span style="color:black">,   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">         parameters = { <span class="annotation" style="color:rgb(100,100,100)">@Parameter</span><span style="color:black">(name = </span><span class="string" style="color:blue">"sequence"</span><span style="color:black">, value = </span><span class="string" style="color:blue">"seq_payablemoney"</span><span style="color:black">) })  </span></span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
四、通过@GenericGenerator自定义主键生成策略 <br>
如果实际应用中,主键策略为程序指定了就用程序指定的主键(assigned),没有指定就从sequence中取。 <br>
明显上面所讨论的策略都不满足,只好自己扩展了,集成assigned和sequence两种策略。 <br>
<br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">class</span><span style="color:black"> AssignedSequenceGenerator </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">extends</span><span style="color:black"> SequenceGenerator </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">implements</span><span style="color:black">   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> PersistentIdentifierGenerator, Configurable {  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">private</span><span style="color:black"> String entityName;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">void</span><span style="color:black"> configure(Type type, Properties params, Dialect dialect) </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">throws</span><span style="color:black"> MappingException {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  entityName = params.getProperty(ENTITY_NAME);  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">if</span><span style="color:black"> (entityName==</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">null</span><span style="color:black">) {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">   <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">throw</span><span style="color:black"> </span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">new</span><span style="color:black"> MappingException(</span><span class="string" style="color:blue">"no entity name"</span><span style="color:black">);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  }  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">super</span><span style="color:black">.configure(type, params, dialect);    </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> }  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">   </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">public</span><span style="color:black"> Serializable generate(SessionImplementor session, Object obj)   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">throws</span><span style="color:black"> HibernateException {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  Serializable id = session.getEntityPersister( entityName, obj )   </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    .getIdentifier( obj, session.getEntityMode() );  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">if</span><span style="color:black"> (id==</span><span class="keyword" style="color:rgb(127,0,85); font-weight:bold">null</span><span style="color:black">) {  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">   id = <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">super</span><span style="color:black">.generate(session, obj);  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  }  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">    </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">  <span class="keyword" style="color:rgb(127,0,85); font-weight:bold">return</span><span style="color:black"> id;  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"> }  </span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">}  </span></li></ol>
<div class="save_code tracking-ad" data-mod="popu_249" style="display: none;"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>
<br>
<br>
实际应用中,定义同sequence。 <br>
<div class="dp-highlighter" id="" style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; font-size:12px; background-color:transparent; width:659px; overflow-x:auto; overflow-y:auto; margin-left:9px; padding-top:1px; padding-right:1px; padding-bottom:1px; padding-left:1px; word-break:break-all; word-wrap:break-word">
<div class="bar">
<div class="tools" style="padding-top:3px; padding-right:3px; padding-bottom:3px; padding-left:3px; text-align:left; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; color:black; font-weight:bold">
Java代码  <a href="http://xiaogui9317170.iteye.com/blog/283526" title="收藏这段代码" style="color:rgb(0,102,153); text-decoration:none"><img class="star" src="http://xiaogui9317170.iteye.com/images/icon_star.png" alt="收藏代码" style="border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial"></a></div>
</div>
<ol start="1" class="dp-j" style="font-size:1em; line-height:1.4em; margin-top:0px; margin-right:0px; margin-bottom:1px; margin-left:0px; padding-top:2px; padding-right:0px; padding-bottom:2px; padding-left:0px; border-top-width:1px; border-right-width:1px; border-bottom-width:1px; border-left-width:1px; border-top-style:solid; border-right-style:solid; border-bottom-style:solid; border-left-style:solid; border-top-color:rgb(209,215,220); border-right-color:rgb(209,215,220); border-bottom-color:rgb(209,215,220); border-left-color:rgb(209,215,220); list-style-type:decimal; list-style-position:initial; background-color:rgb(255,255,255); color:rgb(43,145,175)">
<li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GeneratedValue</span><span style="color:black">(generator = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">)  </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black"><span class="annotation" style="color:rgb(100,100,100)">@GenericGenerator</span><span style="color:black">(name = </span><span class="string" style="color:blue">"paymentableGenerator"</span><span style="color:black">, strategy = </span><span class="string" style="color:blue">"AssignedSequenceGenerator"</span><span style="color:black">,   </span></span></li><li style="font-size:1em; margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:38px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:10px; border-left-width:1px; border-left-style:solid; border-left-color:rgb(209,215,220); background-color:rgb(250,250,250); line-height:18px">
<span style="color:black">     parameters = { <span class="annotation" style="color:rgb(100,100,100)">@Parameter</span><span style="color:black">(name = </span><span class="string" style="color:blue">"sequence"</span><span style="color:black">, value = </span><span class="string" style="color:blue">"seq_payablemoney"</span><span style="color:black">) })  </span></span></li></ol>
<div><span style="color:#2b91af"><span style="line-height:16px"><br>
</span></span></div>
<div><span style="color:#2b91af"><span style="line-height:16px"><br>
</span></span></div>
<div><span style="color:#2b91af"><span style="line-height:16px"><br>
</span></span></div>
<div><span style="color:#2b91af"><span style="line-height:16px"><span style="color:rgb(73,73,73); font-family:Verdana,宋体,sans-serif; line-height:18px; background-color:rgb(224,195,161)"></span></span></span>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(100,100,100); font-size:10.5pt; font-family:'Courier new'">四种<a href="http://lib.csdn.net/base/mysql" class="replace_word" title="MySQL知识库" target="_blank" style="color:#df3434; font-weight:bold;">数据库</a>的支持情况如下:</span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px"><wbr></p>
<table style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; line-height:normal; border-collapse:collapse">
<tbody>
<tr>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-width:0.5pt; border-left-style:solid; border-left-color:rgb(0,0,0); border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-width:0.5pt; border-top-style:solid; border-top-color:rgb(0,0,0); border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; font-family:宋体">数据库名称</span></p>
</td>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-style:none; border-left-width:initial; border-left-color:initial; border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-width:0.5pt; border-top-style:solid; border-top-color:rgb(0,0,0); border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; font-family:宋体">支持的</span><span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; font-family:宋体">id<span style="font-family:宋体; word-wrap:normal; word-break:normal; line-height:21px">策略</span></span></p>
</td>
</tr>
<tr>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-width:0.5pt; border-left-style:solid; border-left-color:rgb(0,0,0); border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-style:none; border-top-width:initial; border-top-color:initial; border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; font-family:宋体"><a href="http://lib.csdn.net/base/mysql" class="replace_word" title="MySQL知识库" target="_blank" style="color:#df3434; font-weight:bold;">MySQL</a></span></p>
</td>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-style:none; border-left-width:initial; border-left-color:initial; border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-style:none; border-top-width:initial; border-top-color:initial; border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>TABLE</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>AUTO</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>IDENTITY</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(255,0,0); font-size:10.5pt; background-color:rgb(192,192,192); font-family:宋体"><em>不支持</em></span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(255,0,0); font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(255,0,0); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>SEQUENCE</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(255,0,0); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em><br>
</em></span></p>
</td>
</tr>
<tr>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-width:0.5pt; border-left-style:solid; border-left-color:rgb(0,0,0); border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-style:none; border-top-width:initial; border-top-color:initial; border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; font-family:宋体"><a href="http://lib.csdn.net/base/oracle" class="replace_word" title="Oracle知识库" target="_blank" style="color:#df3434; font-weight:bold;">Oracle</a></span></p>
</td>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-style:none; border-left-width:initial; border-left-color:initial; border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-style:none; border-top-width:initial; border-top-color:initial; border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">strategy=</span><span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'">GenerationType</span><span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'"><em>AUTO</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>SEQUENCE</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>TABLE</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(255,0,0); font-size:10.5pt; background-color:rgb(255,255,255); font-family:宋体"><em>不支持</em></span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(255,0,0); font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(255,0,0); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>IDENTITY</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(255,0,0); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em><br>
</em></span></p>
</td>
</tr>
<tr>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-width:0.5pt; border-left-style:solid; border-left-color:rgb(0,0,0); border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-style:none; border-top-width:initial; border-top-color:initial; border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; font-family:宋体">postgreSQL</span></p>
</td>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-style:none; border-left-width:initial; border-left-color:initial; border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-style:none; border-top-width:initial; border-top-color:initial; border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>TABLE</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>AUTO</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>IDENTITY</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>SEQUENCE</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:宋体"><em>都支持</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:宋体"><em><br>
</em></span></p>
</td>
</tr>
<tr>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-width:0.5pt; border-left-style:solid; border-left-color:rgb(0,0,0); border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-style:none; border-top-width:initial; border-top-color:initial; border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; font-family:宋体">kingbase</span></p>
</td>
<td style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0pt; padding-right:5.4pt; padding-bottom:0pt; padding-left:5.4pt; font-family:Verdana,宋体,sans-serif; line-height:18px; width:230.4pt; border-left-style:none; border-left-width:initial; border-left-color:initial; border-right-width:0.5pt; border-right-style:solid; border-right-color:rgb(0,0,0); border-top-style:none; border-top-width:initial; border-top-color:initial; border-bottom-width:0.5pt; border-bottom-style:solid; border-bottom-color:rgb(0,0,0)" width="307" valign="top">
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>TABLE</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>SEQUENCE</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>IDENTITY</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; font-size:10.5pt; background-color:rgb(255,255,255); font-family:'Courier new'">GenerationType.</span><span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:'Courier new'"><em>AUTO</em></span></p>
<p style="margin-top:0pt; margin-bottom:0pt; padding-top:0px; padding-bottom:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; list-style-type:none; list-style-position:initial; word-wrap:normal; word-break:normal; line-height:18px">
<span style="word-wrap:normal; word-break:normal; line-height:21px; color:rgb(0,0,192); font-size:10.5pt; background-color:rgb(192,192,192); font-family:宋体"><em>都支持</em></span></p>
</td>
</tr>
</tbody>
</table>
<br>
</div>
<div class="save_code tracking-ad" data-mod="popu_249" style="display: none;"><a href="javascript:;" target="_blank"><img src="http://static.blog.csdn.net/images/save_snippets.png"></a></div></div>

Hibernate注解(一)之@GeneratedValue相关推荐

  1. Hibernate注解使用以及Spring整合

    (1) 简介: 在过去几年里,Hibernate不断发展,几乎成为Java数据库持久性的事实标准.它非常强大.灵活,而且具备了优异的性能.在本文中,我们将了解如何使用Java 5 注释来简化Hiber ...

  2. Hibernate学习之Hibernate注解总结

    Hibernate学习之Hibernate注解总结http://www.bieryun.com/3269.html 一.类级别的注解 @Entity name:表的名字(可选)一般表名和类名相同 必须 ...

  3. (转) Hibernate注解开发

    http://blog.csdn.net/yerenyuan_pku/article/details/70162268 Hibernate注解开发 在Hibernate中我们一般都会使用注解,这样可以 ...

  4. 使用Hibernate注解Annotations进行对象映射的异常处理

    通过Hibernate注解Annotations进行对象映射,想在Oracle数据库中自动创建表,代码如下: 实体类: import javax.persistence.Basic; import j ...

  5. Hibernate 注解 没有加@Column一样会在数据库创建这些字段

    Hibernate 注解 没有加@Column一样会在数据库创建这些字段 如下一个注解类: package com.hyy.hibernate.one_to_many.domain;import ja ...

  6. Hibernate 注解 实现一对多

    首先,我们知道,班级与学生是一对多关系.笔者就以此来编写Hibernate注解实现一对多关系. 先上[班级]类:Clazz.java (这里千万不要用class,否则你懂得...),代码如下: pac ...

  7. Hibernate注解完整文档

    第 2 章 实体Bean       第 2 章 实体Bean 2.1. 简介 本章内容覆盖了EJB3.0实体bean的注解规范以及Hibernate特有的扩展. 2.2. 用EJB3注解进行映射 现 ...

  8. 利用Spring Hibernate注解packagesToScan的简化自动扫描方式

    发现一种Spring Hibernate 注解的简化方式 原始方式 <property name="annotatedClasses"> <list> &l ...

  9. Hibernate 注解学习

    /** * @author liuguangyi * @content ejb3注解的API定义在javax.persistence.*包里面. * * 注释说明: * @Entity -- 将一个类 ...

最新文章

  1. Facebook暂停中国工具类应用广告
  2. 新品秀:Dell Cast,让Android平板变身台式PC
  3. xa协议 mysql_分布式事务XA实现数据一致性的协议与原理
  4. 40无法u盘启动_戴尔主板bios设置u盘启动 戴尔台式电脑如何bios设置U盘启动教程...
  5. currentTitle的用法
  6. idea启动tomcat没有加载项目_震惊!我三步就搞定了 Tomcat 源码环境搭建!
  7. gifrecord可以卸载吗_频繁安装卸载 App,手机真能受得了吗?!
  8. DB9 公头母头引脚定义及连接
  9. 所谓厉害的人,遇到问题时的思维模式与我们的差别在哪?(转自知乎)
  10. 大型网站技术架构 学习总结一(基础了解)
  11. 【PotPlayer】敲好用的本地视频播放器
  12. 紫猫插件-网络共享数据(7-15)
  13. 解决element为新版的 vue-cli 准备了相应的 Element 插件的报错(缺少头像组件)
  14. 光纤收发器tx和rx是什么意思?二者有什么区别?
  15. SystemUI Monkey测试原生代码报错:MLand类NullPointerException
  16. RHEL8.x-RedHat-Podman
  17. Part 1: 3.1 时序逻辑~3.2 flip flop 触发器寄存器
  18. 给图像增加一种噪声并利用至少两种低通或高通滤波器实现频率域的滤波
  19. connect() failed (10061: No connection could be made because the target machine actively refused it
  20. 关于IDM在b站的视频中不显示下载浮条的为题?

热门文章

  1. 29张美图深度解密优衣库!
  2. JS Sequence Diagrams
  3. HTML链接(详细)与分割线(部分)
  4. 7. 可执行程序的装载
  5. 互联网服务平台身份核验解决方案
  6. Spring数据脱敏
  7. 旅游类小程序的优势将带来怎样的旅游体验
  8. DS18B20读取温度,序号匹配
  9. 计算机控制采样周期计算公式,科学网—计算步长和采样周期 - 王永林的博文
  10. 独立显卡和集成显卡的区别