<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>~SingleForum~无废话记录~: Recent Posts</title>
<link>http://www.ll19.com/bb/</link>
<description>~19~记录点有用的好吗？少说废话少装b~</description>
<language>en</language>
<pubDate>Wed, 08 Feb 2012 17:09:54 +0000</pubDate>

<item>
<title>admin on "innodb和myisam"</title>
<link>http://www.ll19.com/bb/topic/123#post-123</link>
<pubDate>Tue, 12 Jan 2010 03:13:54 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">123@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;myisam属于非事务安全型，innodb和bdb属于事务安全型，在使用上，包括建立表，insert，select等等操作上有没有什么区别。但是myisam引擎速度比较快、比较简单、而InnoDB支持外键、其速度相对就慢了。&#60;/p&#62;
&#60;p&#62;  MyISAM类型的表强调的是性能，其执行数度比InnoDB类型更快，但是不提供事务支持，而InnoDB提供事务支持已经外部键等高级数据库功能。这 样就可以根据数据表不同的用处是用不同的存储类型。另外，MyISAM类型的二进制数据文件可以在不同操作系统中迁移。也就是可以直接从Windows系统拷贝到linux系统中使用。所以我一般都是使用myisam，因为这次用的也不是很深入的。&#60;/p&#62;
&#60;p&#62;  如果把这类型从MyISAM转成 InnoDB会不会有问题、但是全文索引失效.&#60;/p&#62;
&#60;p&#62;  使用两种的选择：如果你的数据执行大量的INSERT或UPDATE，出于性能方面的考虑，应该使用InnoDB表。如果执行大量的SELECT，MyISAM是更好的选择。若需要使用事务处理，但是原来的数据表使用的是myisam，就需要改为bdb或者innodb，这样基于myisam的程序，将类型改为innodb后，其程序不用改动……
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "MySQL 更改表的字符编码"</title>
<link>http://www.ll19.com/bb/topic/122#post-122</link>
<pubDate>Tue, 12 Jan 2010 02:41:06 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">122@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;MySQL 更改表的字符编码 &#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="lsql-1"><a href="#" onclick="javascript:showPlainTxt('sql-1'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">SQL:</span><br /><div id="sql-1">
<div class="sql"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span>&nbsp; privilege<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> convert <span style="color: #993333; font-weight: bold;">TO</span> character <span style="color: #993333; font-weight: bold;">SET</span> utf8 collate utf8_general_ci<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>;&amp;<span style="color: #808080; font-style: italic;">#60;br /&amp;#62; </span></div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;(1)表示要改的表的字符编码 (2)表示要改成什么样的字符编码
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "js array的排序"</title>
<link>http://www.ll19.com/bb/topic/121#post-121</link>
<pubDate>Mon, 11 Jan 2010 03:51:51 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">121@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;简单的排序&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljavascript-2"><a href="#" onclick="javascript:showPlainTxt('javascript-2'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span><br /><div id="javascript-2">
<div class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> arrayValue=<span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;arrayValue<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #CC0000;color:#800000;">10</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;arrayValue<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #CC0000;color:#800000;">5</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;arrayValue<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #CC0000;color:#800000;">4</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;arrayValue.<span style="color: #006600;">sort</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>a,b<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> b-a;<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #000066;">alert</span> <span style="color: #66cc66;">&#40;</span>arrayValue<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;数组的排序:sort()方法. 但sort()方法本身是按ASCII字符代码从小到大排列的.所以说,如果是数字的话,可能会有问题，但是: sort()方法可以接收一个比较函数的参数。&#60;/p&#62;
&#60;p&#62;下面的例子：&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljavascript-3"><a href="#" onclick="javascript:showPlainTxt('javascript-3'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span><br /><div id="javascript-3">
<div class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> compareint<span style="color: #66cc66;">&#40;</span>int1, int2<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> iNum1 = parseInt<span style="color: #66cc66;">&#40;</span>int1<span style="color: #66cc66;">&#41;</span>;<span style="color: #009900; font-style: italic;">//强制转换成int 型;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> iNum2 = parseInt<span style="color: #66cc66;">&#40;</span>int2<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>iNum1 &amp;#38;lt; iNum2<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> -<span style="color: #CC0000;color:#800000;">1</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>iNum1 &amp;#38;gt; iNum2<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;color:#800000;">1</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;color:#800000;">0</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> arr = <span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;color:#800000;">3</span>, <span style="color: #CC0000;color:#800000;">32</span>, <span style="color: #CC0000;color:#800000;">2</span>, <span style="color: #CC0000;color:#800000;">5</span><span style="color: #66cc66;">&#93;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">arr.<span style="color: #006600;">sort</span><span style="color: #66cc66;">&#40;</span>compareint<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>arr.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<span style="color: #009900; font-style: italic;">//输出:2,3,5,32&amp;#60;br /&amp;#62; </span></div></li></ol></div>
</div></div><br />
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "关于onsubmit不执行 - -"</title>
<link>http://www.ll19.com/bb/topic/120#post-120</link>
<pubDate>Mon, 11 Jan 2010 03:49:31 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">120@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;button执行的函数中，执行document.forms[0].submit();是不执行onsubmit事件的。&#60;/p&#62;
&#60;p&#62;只有点击submit按钮的时候才执行&#60;br /&#62;
即form 中的onsubmit=&#34;return check();&#34;&#60;br /&#62;
或&#60;br /&#62;
document.test.onsubmit = function () {&#60;br /&#62;
		alert (3322);&#60;br /&#62;
		return false;&#60;br /&#62;
		};&#60;br /&#62;
之类~&#60;/p&#62;
&#60;p&#62;即使是在form中加入了  onsubmit=&#34;return check();&#34;&#60;br /&#62;
用button执行函数来document.forms[0].submit();&#60;br /&#62;
也不会执行onsubmit事件
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "获取浏览器可视方法"</title>
<link>http://www.ll19.com/bb/topic/119#post-119</link>
<pubDate>Mon, 11 Jan 2010 03:46:39 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">119@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;获取浏览器可视方法&#60;br /&#62;
var de=document.documentElement;&#60;br /&#62;
var db=document.body;&#60;br /&#62;
var viewW=de.clientWidth==0 ?  db.clientWidth : de.clientWidth;&#60;br /&#62;
var viewH=de.clientHeight==0 ?  db.clientHeight : de.clientHeight;&#60;br /&#62;
可以全屏显示FLASH用
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "jquery的Unbind"</title>
<link>http://www.ll19.com/bb/topic/118#post-118</link>
<pubDate>Mon, 11 Jan 2010 03:40:23 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">118@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;Unbind只是 用来解除bind上去的函数的&#60;/p&#62;
&#60;p&#62;所以如果你想这么去删的话 那就不要直接写onclick 而是 jQuery(document).ready(function(){&#60;br /&#62;
用bind去加
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "Spring调用存储过程一个小记录"</title>
<link>http://www.ll19.com/bb/topic/117#post-117</link>
<pubDate>Sun, 03 Jan 2010 16:38:05 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">117@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;Spring调用存储过程一个小记录&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljava-4"><a href="#" onclick="javascript:showPlainTxt('java-4'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-4">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> testSpringPackage<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;SpringStoredProce springStoredProce = <span style="color: #000000; font-weight: bold;">new</span> SpringStoredProce<span style="color: #66cc66;">&#40;</span>this&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">getJdbcTemplate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; List&amp;#38;lt;Map&amp;#38;gt; resultList = springStoredProce.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span>, <span style="color: #cc66cc;color:#800000;">10</span>,&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;#34; and t.<span style="color: #006600;">seed_name_cn</span> like <span style="color: #ff0000;">'%竹%'</span> &amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;color:#800000;">0</span>; i &amp;#38;lt; resultList.<span style="color: #006600;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AMap+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Map</span></a> rowMap = resultList.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> userId = rowMap.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span>&amp;#34;seed_name_cn&amp;#34;<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> name = rowMap.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span>&amp;#34;g_name_cn&amp;#34;<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> password = rowMap.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span>&amp;#34;tagsids&amp;#34;<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>&amp;#34;USER_ID=&amp;#34; + userId + &amp;#34;\t name=&amp;#34; + name&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + &amp;#34;\t password=&amp;#34; + password<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljava-5"><a href="#" onclick="javascript:showPlainTxt('java-5'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-5">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #a1a100;">import java.sql.CallableStatement;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.sql.Connection;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.sql.ResultSet;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.sql.SQLException;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.util.ArrayList;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.util.HashMap;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.util.List;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.util.Map;&amp;#60;/p&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #a1a100;">import org.springframework.dao.DataAccessException;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import org.springframework.jdbc.core.CallableStatementCallback;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import org.springframework.jdbc.core.CallableStatementCreator;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import org.springframework.jdbc.core.JdbcTemplate;&amp;#60;/p&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #a1a100;">import com.rizon.eiss.util.StringUtils;&amp;#60;/p&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;public <span style="color: #000000; font-weight: bold;">class</span> SpringStoredProce <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> JdbcTemplate jdbcTemplate;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> SpringStoredProce<span style="color: #66cc66;">&#40;</span>JdbcTemplate jdbcTemplate<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">jdbcTemplate</span> = jdbcTemplate;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> List&amp;#38;lt;Map&amp;#38;gt; execute<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">long</span> start_no, <span style="color: #993333;">long</span> end_no, <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> filter<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; List&amp;#38;lt;Map&amp;#38;gt; resultList = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; resultList = <span style="color: #66cc66;">&#40;</span>List&amp;#38;lt;Map&amp;#38;gt;<span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">jdbcTemplate</span>.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> ProcCallableStatementCreator<span style="color: #66cc66;">&#40;</span>start_no, end_no, filter<span style="color: #66cc66;">&#41;</span>,&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> ProcCallableStatementCallback<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>DataAccessException e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3ARuntimeException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">RuntimeException</span></a><span style="color: #66cc66;">&#40;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;#34;execute method error : DataAccessException &amp;#34;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + e.<span style="color: #006600;">getMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> resultList;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #808080; font-style: italic;">/**&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * Create a callable statement in this connection.&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; */</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">class</span> ProcCallableStatementCreator implements&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CallableStatementCreator <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #993333;">long</span> start_no;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #993333;">long</span> end_no;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> filter;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> ProcCallableStatementCreator<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">long</span> start_no, <span style="color: #993333;">long</span> end_no,&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> filter<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">start_no</span> = start_no;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">end_no</span> = end_no;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">filter</span> = filter;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3ACallableStatement+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">CallableStatement</span></a> createCallableStatement<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AConnection+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Connection</span></a> conn<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;<a href="http://www.google.com/search?q=allinurl%3ACallableStatement+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">CallableStatement</span></a> cs = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs = conn.<span style="color: #006600;">prepareCall</span><span style="color: #66cc66;">&#40;</span>&amp;#34;<span style="color: #66cc66;">&#123;</span>call TREE_PACKAGE.<span style="color: #006600;">TREE_FIND</span><span style="color: #66cc66;">&#40;</span>?,?,?,?<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span>&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">registerOutParameter</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>, oracle.<span style="color: #006600;">jdbc</span>.<span style="color: #006600;">OracleTypes</span>.<span style="color: #006600;">CURSOR</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">setLong</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>, start_no<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">setLong</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">3</span>, end_no<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">setString</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">4</span>, filter<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ASQLException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">SQLException</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3ARuntimeException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">RuntimeException</span></a><span style="color: #66cc66;">&#40;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;#34;createCallableStatement method <a href="http://www.google.com/search?q=allinurl%3AError+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Error</span></a> : <a href="http://www.google.com/search?q=allinurl%3ASQLException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">SQLException</span></a> &amp;#34;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + e.<span style="color: #006600;">getMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> cs;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">class</span> ProcCallableStatementCallback implements&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CallableStatementCallback <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> ProcCallableStatementCallback<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AObject+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Object</span></a> doInCallableStatement<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ACallableStatement+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">CallableStatement</span></a> cs<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List&amp;#38;lt;Map&amp;#38;gt; resultsMap = <span style="color: #000000; font-weight: bold;">new</span> ArrayList&amp;#38;lt;Map&amp;#38;gt;<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AResultSet+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">ResultSet</span></a> rs = <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AResultSet+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">ResultSet</span></a><span style="color: #66cc66;">&#41;</span> cs.<span style="color: #006600;">getObject</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Map&amp;#38;lt;String, Object&amp;#38;gt; rowMap = <span style="color: #000000; font-weight: bold;">new</span> HashMap&amp;#38;lt;String, Object&amp;#38;gt;<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;t_id&amp;#34;, rs.<span style="color: #006600;">getLong</span><span style="color: #66cc66;">&#40;</span>&amp;#34;t_id&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;status&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;status&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;tree_name&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;tree_name&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;seed_name_cn&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;seed_name_cn&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;seed_name_en&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;seed_name_en&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;seed_comment&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;seed_comment&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;gid&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;gid&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;g_name_cn&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;g_name_cn&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;g_name_en&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;g_name_en&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;g_class&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;g_class&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;tagsname&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;tagsname&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;tagsids&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;tagsids&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rowMap.<span style="color: #006600;">put</span><span style="color: #66cc66;">&#40;</span>&amp;#34;tags_des&amp;#34;, StringUtils.<span style="color: #006600;">Trim</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span>&amp;#34;tags_des&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resultsMap.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>rowMap<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rs.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ASQLException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">SQLException</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3ARuntimeException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">RuntimeException</span></a><span style="color: #66cc66;">&#40;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;#34;doInCallableStatement method error : <a href="http://www.google.com/search?q=allinurl%3ASQLException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">SQLException</span></a> &amp;#34;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + e.<span style="color: #006600;">getMessage</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> resultsMap;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "DWR返回LIST"</title>
<link>http://www.ll19.com/bb/topic/116#post-116</link>
<pubDate>Sun, 03 Jan 2010 16:32:16 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">116@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;DWR返回LIST&#60;/p&#62;
&#60;p&#62;list中如果装载的不是基本类型的数据，而是java bean的话，需要在dwr.xml中配置convert参数，才能在页面上将数据 转换成js对象。&#60;/p&#62;
&#60;p&#62;如果配置了这个参数的话，在页面上使用data.XXX来访问该对象中的属性。比如有个user对象里面有name属性，和getName方法，则只需要 使用data.name来取得该值。&#60;/p&#62;
&#60;p&#62;LIST中的BEAN其实就是转换成了JSON&#60;/p&#62;
&#60;p&#62;具体做法如下 （网络搜索的例子）&#60;/p&#62;
&#60;p&#62;dwr.xml里的代码如下：&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="lxml-6"><a href="#" onclick="javascript:showPlainTxt('xml-6'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">XML:</span><br /><div id="xml-6">
<div class="xml"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;dwr<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ddbb00;">&amp;#38;</span>lt;allow<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;create creator=<span style="color: #ddbb00;">&amp;#34;</span>new<span style="color: #ddbb00;">&amp;#34;</span> javascript=<span style="color: #ddbb00;">&amp;#34;</span>DwrTest<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ddbb00;">&amp;#38;</span>lt;param name=<span style="color: #ddbb00;">&amp;#34;</span>class<span style="color: #ddbb00;">&amp;#34;</span> value=<span style="color: #ddbb00;">&amp;#34;</span>com.Dao.DwrTest<span style="color: #ddbb00;">&amp;#34;</span>/<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ddbb00;">&amp;#38;</span>lt;/create<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ddbb00;">&amp;#38;</span>lt;convert match=<span style="color: #ddbb00;">&amp;#34;</span>com.Action.Admin<span style="color: #ddbb00;">&amp;#34;</span> converter=<span style="color: #ddbb00;">&amp;#34;</span>bean<span style="color: #ddbb00;">&amp;#34;</span> <span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ddbb00;">&amp;#38;</span>lt;param name=<span style="color: #ddbb00;">&amp;#34;</span>include<span style="color: #ddbb00;">&amp;#34;</span> value=<span style="color: #ddbb00;">&amp;#34;</span>id,admin_Name,admin_Pwd,mark_id<span style="color: #ddbb00;">&amp;#34;</span> /<span style="color: #ddbb00;">&amp;#38;</span>gt;&nbsp; &nbsp;// Admin的bean中包含这四个属性，bean文件内容我就不贴出来了，<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ddbb00;">&amp;#38;</span>lt;/convert<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ddbb00;">&amp;#38;</span>lt;/allow<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;/dwr<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span> </div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;TestDao类的内容如下：&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljava-7"><a href="#" onclick="javascript:showPlainTxt('java-7'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-7">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestDao<span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #993333;">static</span> <a href="http://www.google.com/search?q=allinurl%3AConnection+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Connection</span></a> conn = Conn.<span style="color: #006600;">GetConn</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">//获得数据库连接&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> List&amp;#38;lt;Admin&amp;#38;gt; Send<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> mark<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; List&amp;#38;lt;Admin&amp;#38;gt; list = <span style="color: #000000; font-weight: bold;">new</span> ArrayList&amp;#38;lt;Admin&amp;#38;gt;<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AStatement+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Statement</span></a> stat = conn.<span style="color: #006600;">createStatement</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> QueryStr = &amp;#34;select * from admin_info where mark_id=&amp;#34;+mark+&amp;#34;&amp;#34;;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AResultSet+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">ResultSet</span></a> rs = stat.<span style="color: #006600;">executeQuery</span><span style="color: #66cc66;">&#40;</span>QueryStr<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;Admin admin = <span style="color: #000000; font-weight: bold;">new</span> Admin<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;admin.<span style="color: #006600;">setId</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;admin.<span style="color: #006600;">setAdmin_Name</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;admin.<span style="color: #006600;">setAdmin_Pwd</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;admin.<span style="color: #006600;">setMark_id</span><span style="color: #66cc66;">&#40;</span>rs.<span style="color: #006600;">getInt</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;list.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>admin<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ASQLException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">SQLException</span></a> e<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; e.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> list;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;DwrTest类内容如下：&#60;/p&#62;
&#60;p&#62;[java]&#60;br /&#62;
public class DwrTest{&#60;br /&#62;
    TestDao dao= new TestDao();&#60;br /&#62;
    public List&#38;lt;Admin&#38;gt; Send(int mark) {&#60;br /&#62;
    return dao.Send(mark);&#60;br /&#62;
    }&#60;br /&#62;
}&#60;br /&#62;
[java]&#60;/p&#62;
&#60;p&#62;jsp文件内容如下：&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="lhtml-8"><a href="#" onclick="javascript:showPlainTxt('html-8'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">HTML:</span><br /><div id="html-8">
<div class="html"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;html<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;head<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;meta http-equiv=<span style="color: #ddbb00;">&amp;#34;</span>Content-Type<span style="color: #ddbb00;">&amp;#34;</span> content=<span style="color: #ddbb00;">&amp;#34;</span>text/html; charset=ISO-8859-1<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;TITLE<span style="color: #ddbb00;">&amp;#38;</span>gt;DWR返回list的一个简单例子<span style="color: #ddbb00;">&amp;#38;</span>lt;/TITLE<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;meta http-equiv=Content-Type content=<span style="color: #ddbb00;">&amp;#34;</span>text/html; charset=gb2312<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;script src=<span style="color: #ddbb00;">&amp;#34;</span>dwr/engine.js<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#38;</span>lt;/script<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;script src=<span style="color: #ddbb00;">&amp;#34;</span>dwr/util.js<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#38;</span>lt;/script<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;script src=<span style="color: #ddbb00;">&amp;#34;</span>dwr/interface/DwrTest.js<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#38;</span>lt;/script<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;SCRIPT LANGUAGE=<span style="color: #ddbb00;">&amp;#34;</span>JavaScript<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function CallBack(data) {<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;if (data.length == 0) {<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;alert(<span style="color: #ddbb00;">&amp;#34;</span>参数传递出现错误!<span style="color: #ddbb00;">&amp;#34;</span>);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;}else{<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; for(var i=0;i<span style="color: #ddbb00;">&amp;#38;</span>lt;data.length;i++){<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;addRow(data[i].admin_Name,data[i].admin_Pwd,data[i].mark_id);&nbsp; &nbsp;// 表格添加一行<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; }<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;}<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">}<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function Send(mark){<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;DwrTest.Send(mark,CallBack);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">}<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function showTable(mark){<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;var i=1;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;for(i=form1.maxrow.value; i<span style="color: #ddbb00;">&amp;#38;</span>gt;0 ; i--)<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;{<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;deleteRow(i);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;}<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;form1.maxrow.value = 0;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;Send(mark);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 通过mark参数来判断要动态显示的内容<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">}<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function deleteRow(index){<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;var tableObj=document.getElementById(<span style="color: #ddbb00;">&amp;#34;</span>mytable<span style="color: #ddbb00;">&amp;#34;</span>);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;tableObj.deleteRow(index);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">} <span style="color: #ddbb00;">&amp;#60;</span>/p<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#60;</span>p<span style="color: #ddbb00;">&amp;#62;</span>function addRow(username,password,mark_id){<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;var tableObj=document.getElementById(<span style="color: #ddbb00;">&amp;#34;</span>mytable<span style="color: #ddbb00;">&amp;#34;</span>);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;var newRowObj=tableObj.insertRow(tableObj.rows.length);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;var newColName=newRowObj.insertCell(newRowObj.cells.length);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;var newColPwd=newRowObj.insertCell(newRowObj.cells.length);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;var newColMrk=newRowObj.insertCell(newRowObj.cells.length);<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;newColName.innerHTML=username;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;newColPwd.innerHTML=password;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;newColMrk.innerHTML=mark_id;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; form1.maxrow.value = parseInt(form1.maxrow.value) + 1;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">}<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;/SCRIPT<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;BODY<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;form name=<span style="color: #ddbb00;">&amp;#34;</span>form1<span style="color: #ddbb00;">&amp;#34;</span> <span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;p align=<span style="color: #ddbb00;">&amp;#34;</span>center<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #ddbb00;">&amp;#38;</span>lt;input type=<span style="color: #ddbb00;">&amp;#34;</span>button<span style="color: #ddbb00;">&amp;#34;</span> value=<span style="color: #ddbb00;">&amp;#34;</span>用户类别一 <span style="color: #ddbb00;">&amp;#34;</span> onmouseover=<span style="color: #ddbb00;">&amp;#34;</span>showTable(1)<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt; // 传参数 mark=1<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #ddbb00;">&amp;#38;</span>lt;input type=<span style="color: #ddbb00;">&amp;#34;</span>button<span style="color: #ddbb00;">&amp;#34;</span> value=<span style="color: #ddbb00;">&amp;#34;</span>用户类别二<span style="color: #ddbb00;">&amp;#34;</span> onmouseover=<span style="color: #ddbb00;">&amp;#34;</span>showTable(2)<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #ddbb00;">&amp;#38;</span>lt;input type=<span style="color: #ddbb00;">&amp;#34;</span>button<span style="color: #ddbb00;">&amp;#34;</span> value=<span style="color: #ddbb00;">&amp;#34;</span>用户类别三<span style="color: #ddbb00;">&amp;#34;</span> onmouseover=<span style="color: #ddbb00;">&amp;#34;</span>showTable(3)<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #ddbb00;">&amp;#38;</span>lt;input type=<span style="color: #ddbb00;">&amp;#34;</span>button<span style="color: #ddbb00;">&amp;#34;</span> value=<span style="color: #ddbb00;">&amp;#34;</span>用户类别四<span style="color: #ddbb00;">&amp;#34;</span> onmouseover=<span style="color: #ddbb00;">&amp;#34;</span>showTable(4)<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;/p<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;table width=<span style="color: #ddbb00;">&amp;#34;</span>50%<span style="color: #ddbb00;">&amp;#34;</span> id=<span style="color: #ddbb00;">&amp;#34;</span>mytable<span style="color: #ddbb00;">&amp;#34;</span> border=<span style="color: #ddbb00;">&amp;#34;</span>1<span style="color: #ddbb00;">&amp;#34;</span> bordercolor=<span style="color: #ddbb00;">&amp;#34;</span>whitesmoke<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;<span style="color: #ddbb00;">&amp;#38;</span>lt;tr align=<span style="color: #ddbb00;">&amp;#34;</span>center<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#38;</span>lt;td<span style="color: #ddbb00;">&amp;#38;</span>gt;用户名<span style="color: #ddbb00;">&amp;#38;</span>lt;/td<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#38;</span>lt;td<span style="color: #ddbb00;">&amp;#38;</span>gt;密码<span style="color: #ddbb00;">&amp;#38;</span>lt;/td<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#38;</span>lt;td类 别<span style="color: #ddbb00;">&amp;#38;</span>lt;/td<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#38;</span>lt;/tr<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;/table<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #ddbb00;">&amp;#38;</span>lt;input type=<span style="color: #ddbb00;">&amp;#34;</span>hidden<span style="color: #ddbb00;">&amp;#34;</span> name=<span style="color: #ddbb00;">&amp;#34;</span>maxrow<span style="color: #ddbb00;">&amp;#34;</span> value=<span style="color: #ddbb00;">&amp;#34;</span>0<span style="color: #ddbb00;">&amp;#34;</span><span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;/form<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;/body<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #ddbb00;">&amp;#38;</span>lt;/html<span style="color: #ddbb00;">&amp;#38;</span>gt;<span style="color: #ddbb00;">&amp;#60;</span>br /<span style="color: #ddbb00;">&amp;#62;</span> </div></li></ol></div>
</div></div><br />
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "DWR调用的java代码中使用Session,Request,Responsed"</title>
<link>http://www.ll19.com/bb/topic/115#post-115</link>
<pubDate>Sun, 03 Jan 2010 16:29:56 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">115@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;在Java的服务方法中定义这些类型的参数,让DWR自动传入相应的对象：&#60;/p&#62;
&#60;p&#62;HttpServletRequest,HttpServletResponse,HttpSession,ServletContext,ServletConfig.&#60;/p&#62;
&#60;p&#62;示例如下:&#60;/p&#62;
&#60;p&#62;Java端定义方法: saveOrder(String id, String name, HttpSession session)&#60;/p&#62;
&#60;p&#62;Javascript调用: OrderService.saveOrder(jsID,jsName,callBack)&#60;/p&#62;
&#60;p&#62;注意,这里不需要传入session这个参数,DWR会自动传入,在Java端可以直接使用.
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "DWR提交整个表单"</title>
<link>http://www.ll19.com/bb/topic/114#post-114</link>
<pubDate>Sun, 03 Jan 2010 16:28:28 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">114@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;<div class="igBar"><span id="ljavascript-9"><a href="#" onclick="javascript:showPlainTxt('javascript-9'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span><br /><div id="javascript-9">
<div class="javascript"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> callBackFun<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #009900; font-style: italic;">// formMap是整个表单&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> formMap = DWRUtil.<span style="color: #006600;">getValues</span><span style="color: #66cc66;">&#40;</span>&amp;#34;aform&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; dwrTree.<span style="color: #006600;">addTags</span><span style="color: #66cc66;">&#40;</span>formMap, result<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #003366; font-weight: bold;">function</span> result<span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>data == &amp;#34;success&amp;#34;<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #000066;">alert</span> <span style="color: #66cc66;">&#40;</span>&amp;#34;添加成功！&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #009900; font-style: italic;">//jQuery(&amp;#34;#ajax-response&amp;#34;).show().html(&amp;#34;添加成功！&amp;#34;).fadeOut(5000);&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;jQuery<span style="color: #66cc66;">&#40;</span>&amp;#34;#name&amp;#34;<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">val</span><span style="color: #66cc66;">&#40;</span>&amp;#34;&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;jQuery<span style="color: #66cc66;">&#40;</span>&amp;#34;#slug&amp;#34;<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">val</span><span style="color: #66cc66;">&#40;</span>&amp;#34;&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;jQuery<span style="color: #66cc66;">&#40;</span>&amp;#34;#order&amp;#34;<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">val</span><span style="color: #66cc66;">&#40;</span>&amp;#34;&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #000066;">alert</span> <span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">//jQuery(&amp;#34;#ajax-response&amp;#34;).show().html(data).fadeOut(5000);&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp;<span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62; </div></li></ol></div>
</div></div><br />
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "Hibernate复合主键的配置及调用"</title>
<link>http://www.ll19.com/bb/topic/113#post-113</link>
<pubDate>Sun, 03 Jan 2010 16:24:53 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">113@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;实体&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljava-10"><a href="#" onclick="javascript:showPlainTxt('java-10'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-10">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #a1a100;">import java.io.Serializable;&amp;#60;/p&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #a1a100;">import javax.persistence.Column;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import javax.persistence.EmbeddedId;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import javax.persistence.Entity;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import javax.persistence.Table;&amp;#60;/p&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;@Entity&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">@Table<span style="color: #66cc66;">&#40;</span>name = &amp;#34;FOR_GD_CONFIG&amp;#34;<span style="color: #66cc66;">&#41;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DbConfigEntity <span style="color: #000000; font-weight: bold;">implements</span> <a href="http://www.google.com/search?q=allinurl%3ASerializable+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Serializable</span></a> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;@EmbeddedId&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> DbConfigPk allPk;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #808080; font-style: italic;">// @AttributeOverrides( {&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// @AttributeOverride(name = &amp;#34;fid&amp;#34;, column = @Column(name = &amp;#34;FLOWID&amp;#34;,&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// nullable = false)),&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// @AttributeOverride(name = &amp;#34;m&amp;#34;, column = @Column(name = &amp;#34;MARK&amp;#34;, nullable =&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// false)) })&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> DbConfigPk getAllPk<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">allPk</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setAllPk<span style="color: #66cc66;">&#40;</span>DbConfigPk allPk<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">allPk</span> = allPk;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;@Column<span style="color: #66cc66;">&#40;</span>name = &amp;#34;MARK_CN&amp;#34;, nullable = <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> mC;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> getMc<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">mC</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setMc<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> mC<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">mC</span> = mC;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;@Column<span style="color: #66cc66;">&#40;</span>name = &amp;#34;COLUMN_NAME&amp;#34;, nullable = <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> cn;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> getCn<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">cn</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setCn<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> cn<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">cn</span> = cn;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;实体中的复合主键&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljava-11"><a href="#" onclick="javascript:showPlainTxt('java-11'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-11">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package com.<span style="color: #006600;">rizon</span>.<span style="color: #006600;">lyj</span>.<span style="color: #006600;">gwgd</span>.<span style="color: #006600;">db</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #a1a100;">import java.io.Serializable;&amp;#60;/p&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #a1a100;">import javax.persistence.Column;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import javax.persistence.Embeddable;&amp;#60;/p&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #808080; font-style: italic;">/**&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * - 19. -&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * 复合主键~good luck~&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * @author &amp;#60;a href=&amp;#34;http://www.LL19.com/&amp;#34;&amp;#62;LL19.com&amp;#60;/a&amp;#62;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * @version 1.0&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> */</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;@Embeddable&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DbConfigPk <span style="color: #000000; font-weight: bold;">implements</span> <a href="http://www.google.com/search?q=allinurl%3ASerializable+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Serializable</span></a> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;@Column<span style="color: #66cc66;">&#40;</span>name = &amp;#34;FLOWID&amp;#34;, nullable = <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3ALong+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Long</span></a> fid;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3ALong+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Long</span></a> getFId<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">fid</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setFId<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ALong+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Long</span></a> fid<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">fid</span> = fid;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;@Column<span style="color: #66cc66;">&#40;</span>name = &amp;#34;MARK&amp;#34;, nullable = <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> m;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> getM<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">m</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setM<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> m<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">m</span> = m;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;BEAN&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljava-12"><a href="#" onclick="javascript:showPlainTxt('java-12'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-12">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;public <span style="color: #000000; font-weight: bold;">class</span> DbConfigBean <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3ALong+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Long</span></a> fid;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3ALong+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Long</span></a> getFId<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">fid</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setFId<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ALong+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Long</span></a> fid<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">fid</span> = fid;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> m;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> getM<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">m</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setM<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> m<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">m</span> = m;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> mC;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> getMc<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">mC</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setMc<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> mC<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">mC</span> = mC;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> cn;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> getCn<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">cn</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setCn<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> cn<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">cn</span> = cn;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;实体和BEAN的转换类&#60;br /&#62;
<div class="igBar"><span id="ljava-13"><a href="#" onclick="javascript:showPlainTxt('java-13'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-13">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;public <span style="color: #000000; font-weight: bold;">class</span> DbTools <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">static</span> DbConfigEntity toDbConfigEntity<span style="color: #66cc66;">&#40;</span>DbConfigBean bean<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>bean == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; DbConfigEntity entity = <span style="color: #000000; font-weight: bold;">new</span> DbConfigEntity<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;entity.<span style="color: #006600;">setCn</span><span style="color: #66cc66;">&#40;</span>bean.<span style="color: #006600;">getCn</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; DbConfigPk dbConfigPk = <span style="color: #000000; font-weight: bold;">new</span> DbConfigPk<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; dbConfigPk.<span style="color: #006600;">setFId</span><span style="color: #66cc66;">&#40;</span>bean.<span style="color: #006600;">getFId</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; dbConfigPk.<span style="color: #006600;">setM</span><span style="color: #66cc66;">&#40;</span>bean.<span style="color: #006600;">getM</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; entity.<span style="color: #006600;">setAllPk</span><span style="color: #66cc66;">&#40;</span>dbConfigPk<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; entity.<span style="color: #006600;">setMc</span><span style="color: #66cc66;">&#40;</span>bean.<span style="color: #006600;">getMc</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> entity;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">static</span> DbConfigBean toDbConfigBean<span style="color: #66cc66;">&#40;</span>DbConfigEntity entity<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>entity == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;DbConfigBean bean = <span style="color: #000000; font-weight: bold;">new</span> DbConfigBean<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; bean.<span style="color: #006600;">setCn</span><span style="color: #66cc66;">&#40;</span>entity.<span style="color: #006600;">getCn</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; bean.<span style="color: #006600;">setFId</span><span style="color: #66cc66;">&#40;</span>entity.<span style="color: #006600;">getAllPk</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getFId</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; bean.<span style="color: #006600;">setM</span><span style="color: #66cc66;">&#40;</span>entity.<span style="color: #006600;">getAllPk</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">getM</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; bean.<span style="color: #006600;">setMc</span><span style="color: #66cc66;">&#40;</span>entity.<span style="color: #006600;">getMc</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> bean;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;调用&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljava-14"><a href="#" onclick="javascript:showPlainTxt('java-14'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-14">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>service.<span style="color: #006600;">find0</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;DbConfigBean dbConfigBean = <span style="color: #66cc66;">&#40;</span>DbConfigBean<span style="color: #66cc66;">&#41;</span> service.<span style="color: #006600;">find0</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>dbConfigBean.<span style="color: #006600;">getFId</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>dbConfigBean.<span style="color: #006600;">getM</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>service.<span style="color: #006600;">findMark</span><span style="color: #66cc66;">&#40;</span>&amp;#34;WHN&amp;#34;<span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62; </div></li></ol></div>
</div></div><br />&#60;/p&#62;
&#60;p&#62;SERVICE中&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljava-15"><a href="#" onclick="javascript:showPlainTxt('java-15'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-15">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> List&amp;#38;lt;DbConfigBean&amp;#38;gt; find0<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Criterion<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> criterion = <span style="color: #000000; font-weight: bold;">new</span> Criterion<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; criterion<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span> = Comparison.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span>&amp;#34;allPk.<span style="color: #006600;">fid</span>&amp;#34;, <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">long</span><span style="color: #66cc66;">&#41;</span> <span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; List&amp;#38;lt;DbConfigEntity&amp;#38;gt; entitys = <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">gbConfigDao</span>.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span>criterion<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; List&amp;#38;lt;DbConfigBean&amp;#38;gt; beans = <span style="color: #000000; font-weight: bold;">new</span> ArrayList&amp;#38;lt;DbConfigBean&amp;#38;gt;<span style="color: #66cc66;">&#40;</span>entitys.<span style="color: #006600;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>DbConfigEntity entity : entitys<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beans.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>DbTools.<span style="color: #006600;">toDbConfigBean</span><span style="color: #66cc66;">&#40;</span>entity<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> beans;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> List&amp;#38;lt;DbConfigBean&amp;#38;gt; findMark<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> Mark<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; Criterion<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> criterion = <span style="color: #000000; font-weight: bold;">new</span> Criterion<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; criterion<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span> = Comparison.<span style="color: #006600;">eq</span><span style="color: #66cc66;">&#40;</span>&amp;#34;allPk.<span style="color: #006600;">m</span>&amp;#34;, Mark<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; OrderBy<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> orders = <span style="color: #000000; font-weight: bold;">new</span> OrderBy<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; orders<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #66cc66;">&#40;</span>OrderBy.<span style="color: #006600;">asc</span><span style="color: #66cc66;">&#40;</span>&amp;#34;allPk.<span style="color: #006600;">fid</span>&amp;#34;<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; List&amp;#38;lt;DbConfigEntity&amp;#38;gt; entitys = <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">gbConfigDao</span>.<span style="color: #006600;">find</span><span style="color: #66cc66;">&#40;</span>orders, criterion<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; List&amp;#38;lt;DbConfigBean&amp;#38;gt; beans = <span style="color: #000000; font-weight: bold;">new</span> ArrayList&amp;#38;lt;DbConfigBean&amp;#38;gt;<span style="color: #66cc66;">&#40;</span>entitys.<span style="color: #006600;">size</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>DbConfigEntity entity : entitys<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; beans.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span>DbTools.<span style="color: #006600;">toDbConfigBean</span><span style="color: #66cc66;">&#40;</span>entity<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> beans;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "SPRING事务管理的一个例子"</title>
<link>http://www.ll19.com/bb/topic/112#post-112</link>
<pubDate>Sun, 03 Jan 2010 16:21:01 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">112@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;SPRING事务管理的一个例子&#60;br /&#62;
<div class="igBar"><span id="ljava-16"><a href="#" onclick="javascript:showPlainTxt('java-16'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-16">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/***&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; *&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; * 删除TAGS 需要同时删除tree_posts_tags表中的相关信息&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">&nbsp; &nbsp;&nbsp; */</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">int</span> removeTagsandPost<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> tagsID<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;<a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> countTags = &amp;#34;&amp;#34;;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">final</span> InvocationResult result = <span style="color: #000000; font-weight: bold;">new</span> InvocationResult<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;DataSourceTransactionManager tran = <span style="color: #000000; font-weight: bold;">new</span> DataSourceTransactionManager<span style="color: #66cc66;">&#40;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getDataSource<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; TransactionTemplate trantemplate = <span style="color: #000000; font-weight: bold;">new</span> TransactionTemplate<span style="color: #66cc66;">&#40;</span>tran<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;countTags = <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a><span style="color: #66cc66;">&#41;</span> trantemplate.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> TransactionCallback<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <a href="http://www.google.com/search?q=allinurl%3AObject+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Object</span></a> doInTransaction<span style="color: #66cc66;">&#40;</span>TransactionStatus status<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> sqlTags = &amp;#34;delete from tree_tags t where t.<span style="color: #006600;">t_id</span> = &amp;#34;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + NumberUtils.<span style="color: #006600;">toLong</span><span style="color: #66cc66;">&#40;</span>tagsID<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> sqlPostTags = &amp;#34;delete from tree_posts_tags t where t.<span style="color: #006600;">t_id</span> = &amp;#34;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + NumberUtils.<span style="color: #006600;">toLong</span><span style="color: #66cc66;">&#40;</span>tagsID<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #993333;">int</span> count = getJdbcTemplate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">update</span><span style="color: #66cc66;">&#40;</span>sqlTags,&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AObject+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Object</span></a><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #993333;">int</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #993333;">int</span> countPostTags = getJdbcTemplate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">update</span><span style="color: #66cc66;">&#40;</span>sqlPostTags,&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> <a href="http://www.google.com/search?q=allinurl%3AObject+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Object</span></a><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #993333;">int</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> <a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a>.<span style="color: #006600;">valueOf</span><span style="color: #66cc66;">&#40;</span>count + countPostTags<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>TransactionException te<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; status.<span style="color: #006600;">setRollbackOnly</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>result.<span style="color: #006600;">getException</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">throw</span> te;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;color:#800000;">0</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">return</span> NumberUtils.<span style="color: #006600;">toInt</span><span style="color: #66cc66;">&#40;</span>countTags<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "HIBERNATE复合主键的配置"</title>
<link>http://www.ll19.com/bb/topic/111#post-111</link>
<pubDate>Sun, 03 Jan 2010 16:17:59 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">111@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;1.通常将复合主键单独建一个类；&#60;br /&#62;
2.复合主键类必须实现java.io.Serializable接口，必须重写hashCode和 equals方法；&#60;br /&#62;
3.在映射文件中配置复合主键：&#60;br /&#62;
        &#38;lt;composite-id name=&#34;复合主键类名&#34;&#38;amp; gt;&#60;br /&#62;
            &#38;lt;key-property name=&#34;复合主键属性1&#34; column=&#34;对应字段名&#34; /&#38;gt;&#60;br /&#62;
            &#38;lt;key- property name=&#34;复合主键属性2&#34; column=&#34;对应字段名&#34; /&#38;gt;&#60;br /&#62;
        &#38;lt;/composite-id&#38;gt;&#60;/p&#62;
&#60;p&#62;hibernate.cfg.xml:&#60;/p&#62;
&#60;p&#62;&#38;lt;?xml version='1.0' encoding='UTF-8'?&#38;gt;&#60;br /&#62;
&#38;lt;!DOCTYPE hibernate-configuration PUBLIC&#60;br /&#62;
          &#34;-//Hibernate/Hibernate Configuration DTD 3.0//EN&#34;&#60;br /&#62;
          &#34;http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd&#34;&#38;gt;&#60;/p&#62;
&#60;p&#62;&#38;lt;!-- Generated by MyEclipse Hibernate Tools.                   --&#38;gt;&#60;br /&#62;
&#38;lt;hibernate-configuration&#38;gt;&#60;/p&#62;
&#60;p&#62;&#38;lt;session-factory&#38;gt;&#60;br /&#62;
    &#38;lt;property name=&#34;connection.username&#34;&#38;gt;scott&#38;lt;/property&#38;gt;&#60;br /&#62;
    &#38;lt;property name=&#34;connection.url&#34;&#38;gt;&#60;br /&#62;
        jdbc:oracle:thin:@127.0.0.1:1521:MGC&#60;br /&#62;
    &#38;lt;/property&#38;gt;&#60;br /&#62;
    &#38;lt;property name=&#34;dialect&#34;&#38;gt;&#60;br /&#62;
        org.hibernate.dialect.Oracle9Dialect&#60;br /&#62;
    &#38;lt;/property&#38;gt;&#60;br /&#62;
    &#38;lt;property name=&#34;myeclipse.connection.profile&#34;&#38;gt;MGC&#38;lt;/property&#38;gt;&#60;br /&#62;
    &#38;lt;property name=&#34;connection.password&#34;&#38;gt;tiger&#38;lt;/property&#38;gt;&#60;br /&#62;
    &#38;lt;property name=&#34;connection.driver_class&#34;&#38;gt;&#60;br /&#62;
        oracle.jdbc.driver.OracleDriver&#60;br /&#62;
    &#38;lt;/property&#38;gt;&#60;/p&#62;
&#60;p&#62;    &#38;lt;property name=&#34;show_sql&#34;&#38;gt;true&#38;lt;/property&#38;gt;&#60;br /&#62;
    &#38;lt;mapping&#60;br /&#62;
        resource=&#34;cn/edu/ahau/mgc/hibernate/pojo/YearPeriod.hbm.xml&#34; /&#38;gt;&#60;/p&#62;
&#60;p&#62;&#38;lt;/session-factory&#38;gt;&#60;/p&#62;
&#60;p&#62;&#38;lt;/hibernate-configuration&#38;gt;&#60;/p&#62;
&#60;p&#62;YearPeriodPK.java:&#60;/p&#62;
&#60;p&#62;package cn.edu.ahau.mgc.hibernate.pojo;&#60;/p&#62;
&#60;p&#62;import java.io.Serializable;&#60;/p&#62;
&#60;p&#62;public class YearPeriodPK implements Serializable{&#60;/p&#62;
&#60;p&#62;    private int year;&#60;br /&#62;
    private int period;&#60;/p&#62;
&#60;p&#62;    public int getYear() {&#60;br /&#62;
        return year;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    public void setYear(int year) {&#60;br /&#62;
        this.year = year;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    public int getPeriod() {&#60;br /&#62;
        return period;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    public void setPeriod(int period) {&#60;br /&#62;
        this.period = period;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    @Override&#60;br /&#62;
    public int hashCode() {&#60;br /&#62;
        final int prime = 31;&#60;br /&#62;
        int result = 1;&#60;br /&#62;
        result = prime * result + period;&#60;br /&#62;
        result = prime * result + year;&#60;br /&#62;
        return result;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    @Override&#60;br /&#62;
    public boolean equals(Object obj) {&#60;br /&#62;
        if (this == obj)&#60;br /&#62;
            return true;&#60;br /&#62;
        if (obj == null)&#60;br /&#62;
            return false;&#60;br /&#62;
        if (getClass() != obj.getClass())&#60;br /&#62;
            return false;&#60;br /&#62;
        final YearPeriodPK other = (YearPeriodPK) obj;&#60;br /&#62;
        if (period != other.period)&#60;br /&#62;
            return false;&#60;br /&#62;
        if (year != other.year)&#60;br /&#62;
            return false;&#60;br /&#62;
        return true;&#60;br /&#62;
    }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;YearPeriod.java:&#60;/p&#62;
&#60;p&#62;package cn.edu.ahau.mgc.hibernate.pojo;&#60;/p&#62;
&#60;p&#62;import java.util.Calendar;&#60;/p&#62;
&#60;p&#62;public class YearPeriod {&#60;/p&#62;
&#60;p&#62;    private YearPeriodPK yearPeriodPK;&#60;br /&#62;
    private Calendar beginDate;&#60;br /&#62;
    private Calendar endDate;&#60;/p&#62;
&#60;p&#62;    public YearPeriodPK getYearPeriodPK() {&#60;br /&#62;
        return yearPeriodPK;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    public void setYearPeriodPK(YearPeriodPK yearPeriodPK) {&#60;br /&#62;
        this.yearPeriodPK = yearPeriodPK;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    public Calendar getBeginDate() {&#60;br /&#62;
        return beginDate;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    public void setBeginDate(Calendar beginDate) {&#60;br /&#62;
        this.beginDate = beginDate;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    public Calendar getEndDate() {&#60;br /&#62;
        return endDate;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    public void setEndDate(Calendar endDate) {&#60;br /&#62;
        this.endDate = endDate;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;YearPeriod.hbm.xml:&#60;/p&#62;
&#60;p&#62;&#38;lt;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#38;gt;&#60;br /&#62;
&#38;lt;!DOCTYPE hibernate-mapping PUBLIC &#34;-//Hibernate/Hibernate Mapping DTD 3.0//EN&#34;&#60;br /&#62;
&#34;http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd&#34;&#38;gt;&#60;br /&#62;
&#38;lt;!--&#60;br /&#62;
    Mapping file autogenerated by MyEclipse Persistence Tools&#60;br /&#62;
--&#38;gt;&#60;br /&#62;
&#38;lt;hibernate-mapping&#38;gt;&#60;br /&#62;
    &#38;lt;class name=&#34;cn.edu.ahau.mgc.hibernate.pojo.YearPeriod&#34; table=&#34;YEARPERIOD&#34; schema=&#34;SCOTT&#34;&#38;gt;&#60;br /&#62;
        &#38;lt;composite-id name=&#34;YearPeriodPK&#34;&#38;gt;&#60;br /&#62;
            &#38;lt;key-property name=&#34;year&#34; column=&#34;YEAR&#34; /&#38;gt;&#60;br /&#62;
            &#38;lt;key-property name=&#34;Period&#34; column=&#34;PERIOD&#34; /&#38;gt;&#60;br /&#62;
        &#38;lt;/composite-id&#38;gt;&#60;br /&#62;
        &#38;lt;property name=&#34;beginDate&#34; type=&#34;java.util.Calendar&#34; column=&#34;BEGINDATE&#34; /&#38;gt;&#60;br /&#62;
        &#38;lt;property name=&#34;endDate&#34; type=&#34;java.util.Calendar&#34; column=&#34;ENDDATE&#34; /&#38;gt;&#60;br /&#62;
    &#38;lt;/class&#38;gt;&#60;br /&#62;
&#38;lt;/hibernate-mapping&#38;gt;&#60;/p&#62;
&#60;p&#62;HibernateSessionFactory.java:&#60;/p&#62;
&#60;p&#62;package cn.edu.ahau.mgc.hibernate.many2one.factory;&#60;/p&#62;
&#60;p&#62;import org.hibernate.HibernateException;&#60;br /&#62;
import org.hibernate.Session;&#60;br /&#62;
import org.hibernate.cfg.Configuration;&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * Configures and provides access to Hibernate sessions, tied to the&#60;br /&#62;
 * current thread of execution.  Follows the Thread Local Session&#60;br /&#62;
 * pattern, see {@link &#60;a href=&#34;http://hibernate.org/42.html&#34; rel=&#34;nofollow&#34;&#62;http://hibernate.org/42.html&#60;/a&#62; }.&#60;br /&#62;
 */&#60;br /&#62;
public class HibernateSessionFactory {&#60;/p&#62;
&#60;p&#62;    /**&#60;br /&#62;
     * Location of hibernate.cfg.xml file.&#60;br /&#62;
     * Location should be on the classpath as Hibernate uses&#60;br /&#62;
     * #resourceAsStream style lookup for its configuration file.&#60;br /&#62;
     * The default classpath location of the hibernate config file is&#60;br /&#62;
     * in the default package. Use #setConfigFile() to update&#60;br /&#62;
     * the location of the configuration file for the current session.&#60;br /&#62;
     */&#60;br /&#62;
    private static String CONFIG_FILE_LOCATION = &#34;/hibernate.cfg.xml&#34;;&#60;br /&#62;
    private static final ThreadLocal&#38;lt;Session&#38;gt; threadLocal = new ThreadLocal&#38;lt;Session&#38;gt;();&#60;br /&#62;
    private  static Configuration configuration = new Configuration();&#60;br /&#62;
    private static org.hibernate.SessionFactory sessionFactory;&#60;br /&#62;
    private static String configFile = CONFIG_FILE_LOCATION;&#60;/p&#62;
&#60;p&#62;    static {&#60;br /&#62;
        try {&#60;br /&#62;
            configuration.configure(configFile);&#60;br /&#62;
            sessionFactory = configuration.buildSessionFactory();&#60;br /&#62;
        } catch (Exception e) {&#60;br /&#62;
            System.err&#60;br /&#62;
                    .println(&#34;%%%% Error Creating SessionFactory %%%%&#34;);&#60;br /&#62;
            e.printStackTrace();&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;br /&#62;
    private HibernateSessionFactory() {&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    /**&#60;br /&#62;
     * Returns the ThreadLocal Session instance.  Lazy initialize&#60;br /&#62;
     * the &#60;code&#62;SessionFactory&#60;/code&#62; if needed.&#60;br /&#62;
     *&#60;br /&#62;
     *  @return Session&#60;br /&#62;
     *  @throws HibernateException&#60;br /&#62;
     */&#60;br /&#62;
    public static Session getSession() throws HibernateException {&#60;br /&#62;
        Session session = (Session) threadLocal.get();&#60;/p&#62;
&#60;p&#62;        if (session == null &#124;&#124; !session.isOpen()) {&#60;br /&#62;
            if (sessionFactory == null) {&#60;br /&#62;
                rebuildSessionFactory();&#60;br /&#62;
            }&#60;br /&#62;
            session = (sessionFactory != null) ? sessionFactory.openSession()&#60;br /&#62;
                    : null;&#60;br /&#62;
            threadLocal.set(session);&#60;br /&#62;
        }&#60;/p&#62;
&#60;p&#62;        return session;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    /**&#60;br /&#62;
     *  Rebuild hibernate session factory&#60;br /&#62;
     *&#60;br /&#62;
     */&#60;br /&#62;
    public static void rebuildSessionFactory() {&#60;br /&#62;
        try {&#60;br /&#62;
            configuration.configure(configFile);&#60;br /&#62;
            sessionFactory = configuration.buildSessionFactory();&#60;br /&#62;
        } catch (Exception e) {&#60;br /&#62;
            System.err&#60;br /&#62;
                    .println(&#34;%%%% Error Creating SessionFactory %%%%&#34;);&#60;br /&#62;
            e.printStackTrace();&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    /**&#60;br /&#62;
     *  Close the single hibernate session instance.&#60;br /&#62;
     *&#60;br /&#62;
     *  @throws HibernateException&#60;br /&#62;
     */&#60;br /&#62;
    public static void closeSession() throws HibernateException {&#60;br /&#62;
        Session session = (Session) threadLocal.get();&#60;br /&#62;
        threadLocal.set(null);&#60;/p&#62;
&#60;p&#62;        if (session != null) {&#60;br /&#62;
            session.close();&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    /**&#60;br /&#62;
     *  return session factory&#60;br /&#62;
     *&#60;br /&#62;
     */&#60;br /&#62;
    public static org.hibernate.SessionFactory getSessionFactory() {&#60;br /&#62;
        return sessionFactory;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    /**&#60;br /&#62;
     *  return session factory&#60;br /&#62;
     *&#60;br /&#62;
     *    session factory will be rebuilded in the next call&#60;br /&#62;
     */&#60;br /&#62;
    public static void setConfigFile(String configFile) {&#60;br /&#62;
        HibernateSessionFactory.configFile = configFile;&#60;br /&#62;
        sessionFactory = null;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    /**&#60;br /&#62;
     *  return hibernate configuration&#60;br /&#62;
     *&#60;br /&#62;
     */&#60;br /&#62;
    public static Configuration getConfiguration() {&#60;br /&#62;
        return configuration;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;ExportToDBCreate.java:&#60;/p&#62;
&#60;p&#62;package cn.edu.ahau.mgc.hibernate.export;&#60;/p&#62;
&#60;p&#62;import org.hibernate.cfg.Configuration;&#60;br /&#62;
import org.hibernate.tool.hbm2ddl.SchemaExport;&#60;/p&#62;
&#60;p&#62;public class ExportToDBCreate {&#60;/p&#62;
&#60;p&#62;    public static void main(String[] args) {&#60;br /&#62;
        Configuration cfg = new Configuration().configure();&#60;br /&#62;
        SchemaExport export = new SchemaExport(cfg);&#60;br /&#62;
        export.create(true, true);&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;InitData.java:&#60;/p&#62;
&#60;p&#62;package cn.edu.ahau.mgc.hibernate.export;&#60;/p&#62;
&#60;p&#62;import java.util.Calendar;&#60;/p&#62;
&#60;p&#62;import org.hibernate.Session;&#60;/p&#62;
&#60;p&#62;import cn.edu.ahau.mgc.hibernate.factory.HibernateSessionFactory;&#60;br /&#62;
import cn.edu.ahau.mgc.hibernate.pojo.YearPeriod;&#60;br /&#62;
import cn.edu.ahau.mgc.hibernate.pojo.YearPeriodPK;&#60;/p&#62;
&#60;p&#62;public class InitData {&#60;/p&#62;
&#60;p&#62;    public static void main(String[] args) {&#60;br /&#62;
        Session session = null;&#60;br /&#62;
        try {&#60;br /&#62;
            session = HibernateSessionFactory.getSession();&#60;br /&#62;
            session.beginTransaction();&#60;/p&#62;
&#60;p&#62;            YearPeriodPK yearPeriodPK = new YearPeriodPK();&#60;br /&#62;
            yearPeriodPK.setYear(2008);&#60;br /&#62;
            yearPeriodPK.setPeriod(1);&#60;/p&#62;
&#60;p&#62;            YearPeriod yearPeriod = new YearPeriod();&#60;br /&#62;
            yearPeriod.setYearPeriodPK(yearPeriodPK);&#60;br /&#62;
            Calendar beginDate = Calendar.getInstance();&#60;br /&#62;
            beginDate.set(2008, 2, 1);&#60;br /&#62;
            Calendar endDate = Calendar.getInstance();&#60;br /&#62;
            endDate.set(2008, 6, 1);&#60;br /&#62;
            yearPeriod.setBeginDate(beginDate);&#60;br /&#62;
            yearPeriod.setEndDate(endDate);&#60;/p&#62;
&#60;p&#62;            session.save(yearPeriod);&#60;br /&#62;
            session.getTransaction().commit();&#60;br /&#62;
        } catch (Exception e) {&#60;br /&#62;
            session.getTransaction().rollback();&#60;br /&#62;
            e.printStackTrace();&#60;br /&#62;
        } finally {&#60;br /&#62;
            HibernateSessionFactory.closeSession();&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;LoadData.java:&#60;/p&#62;
&#60;p&#62;package cn.edu.ahau.mgc.hibernate.export;&#60;/p&#62;
&#60;p&#62;import java.text.SimpleDateFormat;&#60;/p&#62;
&#60;p&#62;import org.hibernate.Session;&#60;/p&#62;
&#60;p&#62;import cn.edu.ahau.mgc.hibernate.factory.HibernateSessionFactory;&#60;br /&#62;
import cn.edu.ahau.mgc.hibernate.pojo.YearPeriod;&#60;br /&#62;
import cn.edu.ahau.mgc.hibernate.pojo.YearPeriodPK;&#60;/p&#62;
&#60;p&#62;public class LoadData {&#60;/p&#62;
&#60;p&#62;    public static void main(String[] args) {&#60;br /&#62;
        Session session = null;&#60;br /&#62;
        try {&#60;br /&#62;
            session = HibernateSessionFactory.getSession();&#60;br /&#62;
            YearPeriodPK yearPeriodPK = new YearPeriodPK();&#60;br /&#62;
            yearPeriodPK.setYear(2008);&#60;br /&#62;
            yearPeriodPK.setPeriod(1);&#60;/p&#62;
&#60;p&#62;            YearPeriod yearPeriod = (YearPeriod) session.load(YearPeriod.class, yearPeriodPK);&#60;br /&#62;
            SimpleDateFormat sdf = new SimpleDateFormat(&#34;yyyy-MM-dd&#34;);&#60;br /&#62;
            System.out.println(&#34;Begin Date:&#34; + sdf.format(yearPeriod.getBeginDate().getTime()));&#60;br /&#62;
            System.out.println(&#34;End Date:&#34; + sdf.format(yearPeriod.getEndDate().getTime()));&#60;/p&#62;
&#60;p&#62;        } catch (Exception e) {&#60;br /&#62;
            e.printStackTrace();&#60;br /&#62;
        } finally {&#60;br /&#62;
            HibernateSessionFactory.closeSession();&#60;br /&#62;
        }&#60;br /&#62;
    }&#60;br /&#62;
}
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "Hibernate Annotation中BLOB、CLOB注解写法"</title>
<link>http://www.ll19.com/bb/topic/110#post-110</link>
<pubDate>Sun, 03 Jan 2010 16:16:48 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">110@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;Hibernate Annotation中BLOB、CLOB注解写法&#60;/p&#62;
&#60;p&#62;在hibernate Annotation中，实体BLOB、CLOB类型的注解与普通的实体属性有些不同，具体操作如下：BLOB类型，类型声明为byte[]：&#60;br /&#62;
private byte[] content；&#60;br /&#62;
注解：&#60;br /&#62;
@Lob&#60;br /&#62;
@Basic(fetch = FetchType.LAZY)&#60;br /&#62;
@Column(name = &#34;CONTENT&#34;, columnDefinition = &#34;BLOB&#34;,nullable=true)&#60;br /&#62;
public byte[] getContent() {&#60;br /&#62;
return this.content;&#60;br /&#62;
}&#60;br /&#62;
public void setContent(byte[] content) {&#60;br /&#62;
this.content = content;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;CLOB类型，类型声明为String即可：&#60;br /&#62;
private String remark；&#60;br /&#62;
注解：&#60;br /&#62;
@Lob&#60;br /&#62;
@Basic(fetch = FetchType.EAGER)&#60;br /&#62;
@Column(name=&#34;REMARK&#34;, columnDefinition=&#34;CLOB&#34;, nullable=true)&#60;br /&#62;
public String getRemark() {&#60;br /&#62;
return this.remark;&#60;br /&#62;
}&#60;br /&#62;
public void setRemark(String recvdocRemark) {&#60;br /&#62;
this.remark = remark;&#60;br /&#62;
}&#60;br /&#62;
按照以上的设置实体类的注解就搞定了。
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "Hibernate的Ejb3注释进行映射"</title>
<link>http://www.ll19.com/bb/topic/109#post-109</link>
<pubDate>Sun, 03 Jan 2010 16:15:56 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">109@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;参考文档&#60;br /&#62;
3.2.0 CR1&#60;br /&#62;
2.2.5. 映射实体Bean的关联关系&#60;br /&#62;
2.2.5.1. 一对一(One-to-one)&#60;br /&#62;
使用@OneToOne注解可以建立实体 bean之间的一对一的关联. 一对一关联有三种情况： 一是关联的实体都共享同样的主键, 二是其中一个实体通过外键关联到另一个实体的主键 (注意要模拟一对一关联必须在外键列上添加唯一约束). 三是通过关联表来保存两个实体之间的连接关系 (注意要模拟一对一关联必须在每一个外键上添加唯一约束).&#60;br /&#62;
首先,我们通过共享主键来进行一对一关联映射:&#60;br /&#62;
@Entity&#60;br /&#62;
public class Body {&#60;br /&#62;
    @Id&#60;br /&#62;
    public Long getId() { return id; }&#60;/p&#62;
&#60;p&#62;    @OneToOne(cascade = CascadeType.ALL)&#60;br /&#62;
    @PrimaryKeyJoinColumn&#60;br /&#62;
    public Heart getHeart() {&#60;br /&#62;
        return heart;&#60;br /&#62;
    }&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
public class Heart {&#60;br /&#62;
    @Id&#60;br /&#62;
    public Long getId() { ...}&#60;br /&#62;
}&#60;br /&#62;
上面的例子通过使用注解@PrimaryKeyJoinColumn定 义了一对一关联.&#60;br /&#62;
下面这个例子使用外键列进行实体的关联.&#60;br /&#62;
@Entity&#60;br /&#62;
public class Customer implements Serializable {&#60;br /&#62;
    @OneToOne(cascade = CascadeType.ALL)&#60;br /&#62;
    @JoinColumn(name=&#34;passport_fk&#34;)&#60;br /&#62;
    public Passport getPassport() {&#60;br /&#62;
        ...&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class Passport implements Serializable {&#60;br /&#62;
    @OneToOne(mappedBy = &#34;passport&#34;)&#60;br /&#62;
    public Customer getOwner() {&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
上面这个例子中,Customer 通过Customer 表中名为的passport_fk 外键列和 Passport关联. @JoinColumn注解定义了联接列(join column). 该注解和@Column注解有 点类似, 但是多了一个名为referencedColumnName的 参数. 该参数定义了所关联目标实体中的联接列. 注意,当referencedColumnName关联到非主键列的时候, 关联的目标类必须实现Serializable, 还要注意的是所映射的属性对应单个列(否则映射无效).&#60;br /&#62;
一对一关联可能是双向的.在双向关联中, 有且仅有一端是作为主体(owner)端存在的：主体端负责维护联接列(即更新). 对于不需要维护这种关系的从表则通过mappedBy属性进行声明. mappedBy的 值指向主体的关联属性. 在上面这个例子中,mappedBy的 值为 passport. 最后,不必也不能再在被关联端(owned side)定义联接列了,因为已经在主体端进行了声明.&#60;br /&#62;
如果在主体没有声明@JoinColumn, 系统自动进行处理： 在主表(owner table)中将创建联接列, 列名为：主体的关联属性名＋下划线＋被关联端的主键列名. 在上面这个例子中是passport_id, 因为Customer中关联属性名为passport, Passport的主键是id.&#60;br /&#62;
The third possibility (using an association table) is very exotic.&#60;br /&#62;
第三种方式也许是最另类的(通过关联表).&#60;br /&#62;
@Entity&#60;br /&#62;
public class Customer implements Serializable {&#60;br /&#62;
    @OneToOne(cascade = CascadeType.ALL)&#60;br /&#62;
    @JoinTable(name = &#34;CustomerPassports&#34;,&#60;br /&#62;
        joinColumns = @JoinColumn(name=&#34;customer_fk&#34;),&#60;br /&#62;
        inverseJoinColumns = @JoinColumn(name=&#34;passport_fk&#34;)&#60;br /&#62;
    )&#60;br /&#62;
    public Passport getPassport() {&#60;br /&#62;
        ...&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class Passport implements Serializable {&#60;br /&#62;
    @OneToOne(mappedBy = &#34;passport&#34;)&#60;br /&#62;
    public Customer getOwner() {&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
Customer通过名为 CustomerPassports的关联表和 Passport关联; 该关联表拥有名为passport_fk的外键列,该 外键指向Passport表,该信息定义为inverseJoinColumn的属性值, 而customer_fk外键列指向Customer表, 该信息定义为 joinColumns的属性值.&#60;br /&#62;
这种关联可能是双向的.在双向关联中, 有且仅有一端是作为主体端存在的：主体端负责维护联接列(即更新). 对于不需要维护这种关系的从表则通过mappedBy属性进行声明. mappedBy的 值指向主体的关联属性. 在上面这个例子中,mappedBy的 值为 passport. 最后,不必也不能再在被关联端(owned side)定义联接列了,因为已经在主体端进行了声明.&#60;br /&#62;
你必须明确定义关联表名和关联列名.&#60;br /&#62;
2.2.5.2. 多对一(Many-to-one)&#60;br /&#62;
在实体属性一级使用@ManyToOne注 解来定义多对一关联:&#60;br /&#62;
@Entity()&#60;br /&#62;
public class Flight implements Serializable {&#60;br /&#62;
    @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )&#60;br /&#62;
    @JoinColumn(name=&#34;COMP_ID&#34;)&#60;br /&#62;
    public Company getCompany() {&#60;br /&#62;
        return company;&#60;br /&#62;
    }&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
其中@JoinColumn是可选的,关联 字段默认值和一对一 (one to one)关联的情况相似, 列名为：主体的关联属性名＋下划线＋被关联端的主键列名. 在这个例子中是company_id, 因为关联的属性是company, Company的主键是id.&#60;br /&#62;
@ManyToOne注解有一个名为targetEntity的参数, 该参数定义了目标实体名.通常不需要定义该参数, 因为在大部分情况下默认值(表示关联关系的属性类型)就可以很好的满足要求了. 不过下面这种情况下这个参数就显得有意义了：使用接口作为返回值而不是常见的实体.&#60;br /&#62;
@Entity()&#60;br /&#62;
public class Flight implements Serializable {&#60;br /&#62;
    @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE}, targetEntity=CompanyImpl.class )&#60;br /&#62;
    @JoinColumn(name=&#34;COMP_ID&#34;)&#60;br /&#62;
    public Company getCompany() {&#60;br /&#62;
        return company;&#60;br /&#62;
    }&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;public interface Company {&#60;br /&#62;
    ...&#60;br /&#62;
对于多对一也可以通过关联表的方式来映射。 通过@JoinTable注 解可定义关联表， 该关联表包含了指回实体表的外键(通过@JoinTable.joinColumns) 以及指向目标实体表的外键(通过@JoinTable.inverseJoinColumns).&#60;br /&#62;
@Entity()&#60;br /&#62;
public class Flight implements Serializable {&#60;br /&#62;
    @ManyToOne( cascade = {CascadeType.PERSIST, CascadeType.MERGE} )&#60;br /&#62;
    @JoinTable(name=&#34;Flight_Company&#34;,&#60;br /&#62;
        joinColumns = @JoinColumn(name=&#34;FLIGHT_ID&#34;),&#60;br /&#62;
        inverseJoinColumns = @JoinColumn(name=&#34;COMP_ID&#34;)&#60;br /&#62;
    )&#60;br /&#62;
    public Company getCompany() {&#60;br /&#62;
        return company;&#60;br /&#62;
    }&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
2.2.5.3. 集合类型&#60;br /&#62;
2.2.5.3.1. 概况&#60;br /&#62;
你可以对 Collection ,List (指有序列表, 而不是索引列表), Map和Set这几种类型进行映射. EJB3规范定义了怎么样使用@javax.persistence.OrderBy 注解来对有序列表进行映射： 该注解接受的参数格式：用逗号隔开的(目标实体)属性名及排序指令, 如firstname asc, age desc,如果该参数为空,则默认以id对该集合进行排序. 如果某个集合在数据库中对应一个关联表(association table)的话,你不能在这个集合属性上面使用@OrderBy注解. 对于这种情况的处理方法,请参考Hibernate Annotation Extensions. EJB3 允许你利用目标实体的一个属性作为Map的key, 这个属性可以用@MapKey(name=&#34;myProperty&#34;)来 声明. 如果使用@MapKey注解的时候不提供 属性名, 系统默认使用目标实体的主键. map的key使用和属性相同的列：不需要为map key定义专用的列，因为map key实际上就表达了一个目标属性。 注意一旦加载,key不再和属性保持同步, 也就是说,如果你改变了该属性的值,在你的Java模型中的key不会自动更新 (请参考Hibernate Annotation Extensions). 很多人被&#38;lt;map&#38;gt;和@MapKey弄糊涂了。 其他它们有两点区别.@MapKey目前还有一些限制,详情请查看论坛或者 我们的JIRA缺陷系统。 注意一旦加载,key不再和属性保持同步, 也就是说,如果你改变了该属性的值,在你的Java模型中的key不会自动更新. (Hibernate 3中Map支持的方式在当前的发布版中还未得到支持).&#60;br /&#62;
Hibernate将 集合分以下几类.&#60;br /&#62;
表 2.1. 集合语义&#60;br /&#62;
语义	Java实现类	注解&#60;br /&#62;
Bag 语义	java.util.List, java.util.Collection	@org.hibernate.annotations.CollectionOfElements 或 @OneToMany 或 @ManyToMany&#60;br /&#62;
List 语义	java.util.List	(@org.hibernate.annotations.CollectionOfElements 或 @OneToMany 或 @ManyToMany) 以及 @org.hibernate.annotations.IndexColumn&#60;br /&#62;
Set 语义	java.util.Set	@org.hibernate.annotations.CollectionOfElements 或 @OneToMany 或 @ManyToMany&#60;br /&#62;
Map 语义	java.util.Map	(@org.hibernate.annotations.CollectionOfElements 或 @OneToMany 或 @ManyToMany) 以及 (空 或 @org.hibernate.annotations.MapKey/MapKeyManyToMany(支 持真正的map), 或 @javax.persistence.MapKey&#60;br /&#62;
从上面可以明确地看到,没有@org.hibernate.annotations.IndexColumn 注解的java.util.List集合将被看作bag类.&#60;br /&#62;
EJB3规范不支持原始类型,核心类型,嵌入式对象的集合.但是Hibernate对此提供了支持 (详情参考 Hibernate Annotation Extensions).&#60;br /&#62;
@Entity public class City {&#60;br /&#62;
    @OneToMany(mappedBy=&#34;city&#34;)&#60;br /&#62;
    @OrderBy(&#34;streetName&#34;)&#60;br /&#62;
    public List&#38;lt;Street&#38;gt; getStreets() {&#60;br /&#62;
        return streets;&#60;br /&#62;
    }&#60;br /&#62;
...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity public class Street {&#60;br /&#62;
    public String getStreetName() {&#60;br /&#62;
        return streetName;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    @ManyToOne&#60;br /&#62;
    public City getCity() {&#60;br /&#62;
        return city;&#60;br /&#62;
    }&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class Software {&#60;br /&#62;
    @OneToMany(mappedBy=&#34;software&#34;)&#60;br /&#62;
    @MapKey(name=&#34;codeName&#34;)&#60;br /&#62;
    public Map&#38;lt;String, Version&#38;gt; getVersions() {&#60;br /&#62;
        return versions;&#60;br /&#62;
    }&#60;br /&#62;
...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
@Table(name=&#34;tbl_version&#34;)&#60;br /&#62;
public class Version {&#60;br /&#62;
    public String getCodeName() {...}&#60;/p&#62;
&#60;p&#62;    @ManyToOne&#60;br /&#62;
    public Software getSoftware() { ... }&#60;br /&#62;
...&#60;br /&#62;
}&#60;br /&#62;
上面这个例子中,City 中包括了以streetName排序的Street的集合. 而Software中包括了以codeName作为 key和以Version作为值的Map.&#60;br /&#62;
除非集合为generic类型,否则你需要指定targetEntity. 这个注解属性接受的参数为目标实体的class.&#60;br /&#62;
2.2.5.3.2. 一对多(One-to-many)&#60;br /&#62;
在属性级使用 @OneToMany注解可 定义一对多关联.一对多关联可以是双向关联.&#60;br /&#62;
2.2.5.3.2.1. 双向(Bidirectional)&#60;br /&#62;
在EJB3规范中多对一这端几乎总是双向关联中的主体(owner)端, 而一对多这端的关联注解为@OneToMany( mappedBy=... )&#60;br /&#62;
@Entity&#60;br /&#62;
public class Troop {&#60;br /&#62;
    @OneToMany(mappedBy=&#34;troop&#34;)&#60;br /&#62;
    public Set&#38;lt;Soldier&#38;gt; getSoldiers() {&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class Soldier {&#60;br /&#62;
    @ManyToOne&#60;br /&#62;
    @JoinColumn(name=&#34;troop_fk&#34;)&#60;br /&#62;
    public Troop getTroop() {&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
Troop 通过troop 属性和Soldier建立了一对多的双向关联. 在mappedBy端不必也不能再定义任何物理映射&#60;br /&#62;
对于一对多的双向映射,如果要一对多这一端维护关联关系, 你需要删除mappedBy元 素并将多对一这端的 @JoinColumn的 insertable和updatable设置为false. 很明显,这种方案不会得到什么明显的优化,而且还会增加一些附加的UPDATE语句.&#60;br /&#62;
@Entity&#60;br /&#62;
public class Troop {&#60;br /&#62;
    @OneToMany&#60;br /&#62;
    @JoinColumn(name=&#34;troop_fk&#34;) //we need to duplicate the physical information&#60;br /&#62;
    public Set&#38;lt;Soldier&#38;gt; getSoldiers() {&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class Soldier {&#60;br /&#62;
    @ManyToOne&#60;br /&#62;
    @JoinColumn(name=&#34;troop_fk&#34;, insertable=false, updatable=false)&#60;br /&#62;
    public Troop getTroop() {&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
2.2.5.3.2.2. 单向(Unidirectional)&#60;br /&#62;
通过在被拥有的实体端(owned entity)增加一个外键列来实现一对多单向关联是很少见的,也是不推荐的. 我们强烈建议通过一个联接表(join table)来实现这种关联(下一节会对此进行解释). 可以通过@JoinColumn注解来描述这种单向关联关系.&#60;br /&#62;
@Entity&#60;br /&#62;
public class Customer implements Serializable {&#60;br /&#62;
    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)&#60;br /&#62;
    @JoinColumn(name=&#34;CUST_ID&#34;)&#60;br /&#62;
    public Set&#38;lt;Ticket&#38;gt; getTickets() {&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class Ticket implements Serializable {&#60;br /&#62;
    ... //no bidir&#60;br /&#62;
}&#60;br /&#62;
Customer 通过 CUST_ID列和Ticket 建立了单向关联关系.&#60;br /&#62;
2.2.5.3.2.3. 通过关联表处理单向关联&#60;br /&#62;
通过联接表处理单向一对多关联是首选方式.这种关联通过@JoinTable注 解来进行描述.&#60;br /&#62;
@Entity&#60;br /&#62;
public class Trainer {&#60;br /&#62;
    @OneToMany&#60;br /&#62;
    @JoinTable(&#60;br /&#62;
            name=&#34;TrainedMonkeys&#34;,&#60;br /&#62;
            joinColumns = @JoinColumn( name=&#34;trainer_id&#34;),&#60;br /&#62;
            inverseJoinColumns = @JoinColumn( name=&#34;monkey_id&#34;)&#60;br /&#62;
    )&#60;br /&#62;
    public Set&#38;lt;Monkey&#38;gt; getTrainedMonkeys() {&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class Monkey {&#60;br /&#62;
    ... //no bidir&#60;br /&#62;
}&#60;br /&#62;
上面这个例子中,Trainer通过 TrainedMonkeys表和 Monkey 建立了单向关联. 其中外键trainer_id关联到Trainer (joinColumns), 而外键monkey_id关联到 Monkey (inversejoinColumns).&#60;br /&#62;
2.2.5.3.2.4. 默认处理机制&#60;br /&#62;
通过联接表来建立单向一对多关联不需要描述任何物理映射. 表名由以下三个部分组成:主表(owner table)表名+下划线+从表(the other side table)表名. 指向主表的外键名：主表表名+下划线+主表主键列名 指向从表的外键名：主表所对应实体的属性名+下划线+从表主键列名 指向从表的外键定义为唯一约束,用来表示一对多的关联关系.&#60;br /&#62;
@Entity&#60;br /&#62;
public class Trainer {&#60;br /&#62;
    @OneToMany&#60;br /&#62;
    public Set&#38;lt;Tiger&#38;gt; getTrainedTigers() {&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class Tiger {&#60;br /&#62;
    ... //no bidir&#60;br /&#62;
}&#60;br /&#62;
上面这个例子中,Trainer和Tiger 通过联接表 Trainer_Tiger建立单向关联关系, 其中外键trainer_id关联到Trainer (主表表名, _(下划线), trainer id), 而外键trainedTigers_id关联到Tiger (属性名称, _(下划线), Tiger表的主键列名).&#60;br /&#62;
2.2.5.3.3. 多对多(Many-to-many)&#60;br /&#62;
2.2.5.3.3.1. 定义&#60;br /&#62;
你可以通过@ManyToMany注解可定 义的多对多关联. 同时,你也需要通过注解@JoinTable描 述关联表和关联条件. 如果是双向关联,其中一段必须定义为owner,另一端必须定义为inverse(在对关联表进行更新操作时这一端将被忽略):&#60;br /&#62;
@Entity&#60;br /&#62;
public class Employer implements Serializable {&#60;br /&#62;
    @ManyToMany(&#60;br /&#62;
        targetEntity=org.hibernate.test.metadata.manytomany.Employee.class,&#60;br /&#62;
        cascade={CascadeType.PERSIST, CascadeType.MERGE}&#60;br /&#62;
    )&#60;br /&#62;
    @JoinTable(&#60;br /&#62;
        name=&#34;EMPLOYER_EMPLOYEE&#34;,&#60;br /&#62;
        joinColumns=@JoinColumn(name=&#34;EMPER_ID&#34;),&#60;br /&#62;
        inverseJoinColumns=@JoinColumn(name=&#34;EMPEE_ID&#34;)&#60;br /&#62;
    )&#60;br /&#62;
    public Collection getEmployees() {&#60;br /&#62;
        return employees;&#60;br /&#62;
    }&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
public class Employee implements Serializable {&#60;br /&#62;
    @ManyToMany(&#60;br /&#62;
        cascade = {CascadeType.PERSIST, CascadeType.MERGE},&#60;br /&#62;
        mappedBy = &#34;employees&#34;,&#60;br /&#62;
        targetEntity = Employer.class&#60;br /&#62;
    )&#60;br /&#62;
    public Collection getEmployers() {&#60;br /&#62;
        return employers;&#60;br /&#62;
    }&#60;br /&#62;
}&#60;br /&#62;
至此,我们已经展示了很多跟关联有关的声明定义以及属性细节. 下面我们将深入介绍@JoinTable注解,该注解定义了联接表的表名, 联接列数组(注解中定义数组的格式为{ A, B, C }), 以及inverse联接列数组. 后者是关联表中关联到Employee主键的列(the &#34;other side&#34;).&#60;br /&#62;
正如前面所示,被关联端不必也不能描述物理映射: 只需要一个简单的mappedBy参 数,该参数包含了主体端的属性名,这样就绑定双方的关系.&#60;br /&#62;
2.2.5.3.3.2. 默认值&#60;br /&#62;
和其他许多注解一样,在多对多关联中很多值是自动生成. 当双向多对多关联中没有定义任何物理映射时,Hibernate根据以下规则生成相应的值. 关联表名:主表表名+_下划线+从表表名, 关联到主表的外键名:主表名+_下划线+主表中的主键列 名. 关联到从表的外键名:主表中用于关联的属性名+_下 划线+从表的主键列名. 以上规则对于双向一对多关联同样有效.&#60;br /&#62;
@Entity&#60;br /&#62;
public class Store {&#60;br /&#62;
    @ManyToMany(cascade = CascadeType.PERSIST)&#60;br /&#62;
    public Set&#38;lt;City&#38;gt; getImplantedIn() {&#60;br /&#62;
        ...&#60;br /&#62;
    }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class City {&#60;br /&#62;
    ... //no bidirectional relationship&#60;br /&#62;
}&#60;br /&#62;
上面这个例子中,Store_Table作 为联接表. Store_id列是联接到Store表的外键. 而implantedIn_id列则联接到City表.&#60;br /&#62;
当双向多对多关联中没有定义任何物理映射时, Hibernate根据以下规则生成相应的值 关联表名: :主表表名+_下划线+从表表名, 关联到主表的外键名:从表用于关联的属性名+_下划线+主表中的主键列名. 关联到从表的外键名:主表用于关联的属性名+_下划线+从表的主键列名. 以上规则对于双向一对多关联同样有效.&#60;br /&#62;
@Entity&#60;br /&#62;
public class Store {&#60;br /&#62;
    @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})&#60;br /&#62;
    public Set&#38;lt;Customer&#38;gt; getCustomers() {&#60;br /&#62;
        ...&#60;br /&#62;
    }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Entity&#60;br /&#62;
public class Customer {&#60;br /&#62;
    @ManyToMany(mappedBy=&#34;customers&#34;)&#60;br /&#62;
    public Set&#38;lt;Store&#38;gt; getStores() {&#60;br /&#62;
        ...&#60;br /&#62;
    }&#60;br /&#62;
}&#60;br /&#62;
在上面这个例子中,Store_Customer作 为联接表. stores_id列是联接到Store表的外键, 而customers_id列联接到City表.&#60;br /&#62;
2.2.5.4. 用cascading实现传播性持久化(Transitive persistence)&#60;br /&#62;
也许你已经注意到了cascade属性接受 的值为CascadeType数组. 在EJB3中的cascade的概念和Hibernate中的传播性持久化以及cascade操作非常类似, 但是在语义上有细微的区别,支持的cascade类型也有点区别:&#60;br /&#62;
•	CascadeType.PERSIST: 如果一个实体是受管状态, 或者当persist()函数被调用时, 触发级联创建(create)操作&#60;br /&#62;
•	CascadeType.MERGE: 如果一个实体是受管状态, 或者当merge()函数被调用时, 触发级联合并(merge)操作&#60;br /&#62;
•	CascadeType.REMOVE: 当delete()函数被调用时, 触发级联删除(remove)操作&#60;br /&#62;
•	CascadeType.REFRESH: 当refresh()函数被调用时, 触发级联更新(refresh)操作&#60;br /&#62;
•	CascadeType.ALL: 以上全部&#60;br /&#62;
关于cascading, create/merge的语义请参考EJB3规范的6.3章节.&#60;br /&#62;
2.2.5.5. 关联关系获取&#60;br /&#62;
通过Hibernate你 可以获得直接或者延迟获取关联实体的功能. fetch参 数可以设置为FetchType.LAZY 或者 FetchType.EAGER. EAGER通过outer join select直接获取关联的对象, 而LAZY(默认值)在第一次访问关联对象的时候才会触发相应的select操作. EJBQL提供了fetch关键字,该关键字可以在进行特殊查询的时候覆 盖默认值. 这对于提高性能来说非常有效,应该根据实际的用例来判断是否选择fetch关键字.&#60;br /&#62;
2.2.6. 映射复合主键与外键&#60;br /&#62;
组合主键使用一个可嵌入的类作为主键表示,因此你需要使用@Id 和@Embeddable两个注解. 还有一种方式是使用@EmbeddedId注解. 注意所依赖的类必须实现 serializable以及实现equals()/hashCode()方法. 你也可以如Mapping identifier properties一章中描述的办法使用@IdClass注 解.&#60;br /&#62;
@Entity&#60;br /&#62;
public class RegionalArticle implements Serializable {&#60;/p&#62;
&#60;p&#62;    @Id&#60;br /&#62;
    public RegionalArticlePk getPk() { ... }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;@Embeddable&#60;br /&#62;
public class RegionalArticlePk implements Serializable { ... }&#60;br /&#62;
或者&#60;br /&#62;
@Entity&#60;br /&#62;
public class RegionalArticle implements Serializable {&#60;/p&#62;
&#60;p&#62;    @EmbeddedId&#60;br /&#62;
    public RegionalArticlePk getPk() { ... }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;public class RegionalArticlePk implements Serializable { ... }&#60;br /&#62;
@Embeddable 注解默认继承了其所属实体的访问类型, 除非显式使用了Hibernate的@AccessType注 解(这个注解不是EJB3标准的一部分). 而@JoinColumns, 即@JoinColumn数组, 定义了关联的组合外键(如果不使用缺省值的话). 显式指明referencedColumnNames是 一个好的实践方式, 否则,Hibernate认为你使用的列顺序和主键声明的顺序一致.&#60;br /&#62;
@Entity&#60;br /&#62;
public class Parent implements Serializable {&#60;br /&#62;
    @Id&#60;br /&#62;
    public ParentPk id;&#60;br /&#62;
    public int age;&#60;/p&#62;
&#60;p&#62;    @OneToMany(cascade=CascadeType.ALL)&#60;br /&#62;
    @JoinColumns ({&#60;br /&#62;
        @JoinColumn(name=&#34;parentCivility&#34;, referencedColumnName = &#34;isMale&#34;),&#60;br /&#62;
        @JoinColumn(name=&#34;parentLastName&#34;, referencedColumnName = &#34;lastName&#34;),&#60;br /&#62;
        @JoinColumn(name=&#34;parentFirstName&#34;, referencedColumnName = &#34;firstName&#34;)&#60;br /&#62;
    })&#60;br /&#62;
    public Set&#38;lt;Child&#38;gt; children; //unidirectional&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
public class Child implements Serializable {&#60;br /&#62;
    @Id @GeneratedValue&#60;br /&#62;
    public Integer id;&#60;/p&#62;
&#60;p&#62;    @ManyToOne&#60;br /&#62;
    @JoinColumns ({&#60;br /&#62;
        @JoinColumn(name=&#34;parentCivility&#34;, referencedColumnName = &#34;isMale&#34;),&#60;br /&#62;
        @JoinColumn(name=&#34;parentLastName&#34;, referencedColumnName = &#34;lastName&#34;),&#60;br /&#62;
        @JoinColumn(name=&#34;parentFirstName&#34;, referencedColumnName = &#34;firstName&#34;)&#60;br /&#62;
    })&#60;br /&#62;
    public Parent parent; //unidirectional&#60;br /&#62;
}&#60;br /&#62;
@Embeddable&#60;br /&#62;
public class ParentPk implements Serializable {&#60;br /&#62;
    String firstName;&#60;br /&#62;
    String lastName;&#60;br /&#62;
    ...&#60;br /&#62;
}&#60;br /&#62;
注意上面的 referencedColumnName显 式使用方式.&#60;br /&#62;
2.2.7. 映射二级表(secondary tables)&#60;br /&#62;
使用类一级的 @SecondaryTable 或 @SecondaryTables 注解可以实 现单个实体到多个表的映射. 使用 @Column 或 者 @JoinColumn 注解中的 table 参数可指定某个列所属的特定表.&#60;br /&#62;
@Entity&#60;br /&#62;
@Table(name=&#34;MainCat&#34;)&#60;br /&#62;
@SecondaryTables({&#60;br /&#62;
    @SecondaryTable(name=&#34;Cat1&#34;, pkJoinColumns={&#60;br /&#62;
        @PrimaryKeyJoinColumn(name=&#34;cat_id&#34;, referencedColumnName=&#34;id&#34;)&#60;br /&#62;
    ),&#60;br /&#62;
    @SecondaryTable(name=&#34;Cat2&#34;, uniqueConstraints={@UniqueConstraint(columnNames={&#34;storyPart2&#34;})})&#60;br /&#62;
})&#60;br /&#62;
public class Cat implements Serializable {&#60;/p&#62;
&#60;p&#62;    private Integer id;&#60;br /&#62;
    private String name;&#60;br /&#62;
    private String storyPart1;&#60;br /&#62;
    private String storyPart2;&#60;/p&#62;
&#60;p&#62;    @Id @GeneratedValue&#60;br /&#62;
    public Integer getId() {&#60;br /&#62;
        return id;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    public String getName() {&#60;br /&#62;
        return name;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    @Column(table=&#34;Cat1&#34;)&#60;br /&#62;
    public String getStoryPart1() {&#60;br /&#62;
        return storyPart1;&#60;br /&#62;
    }&#60;/p&#62;
&#60;p&#62;    @Column(table=&#34;Cat2&#34;)&#60;br /&#62;
    public String getStoryPart2() {&#60;br /&#62;
        return storyPart2;&#60;br /&#62;
    }&#60;br /&#62;
在上面这个例子中,name保存在MainCat表中, storyPart1保存在Cat1表中, storyPart2保存在Cat2表中. Cat1表 通过外键cat_id和MainCat表关联, Cat2表通过id列和MainCat表 关联 (和MainCat的id列同名). 对storyPart2列还定义了唯一约束.&#60;br /&#62;
在JBoss EJB 3指南和Hibernate Annotations单元测试代码中还有更多的例子.
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "Hibernate Annotation几种关联映射"</title>
<link>http://www.ll19.com/bb/topic/108#post-108</link>
<pubDate>Sun, 03 Jan 2010 16:14:29 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">108@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;Hibernate Annotation几种关联映射&#60;br /&#62;
一对一(One-To-One)&#60;br /&#62;
使用@OneToOne注解建立实体Bean之间的一对一关联。一对一关联有三种情况：(1).关联的实体都共享同样的主键，(2).其中一个实体 通过外键关联到另一个实体的主键(注意要模拟一对一关联必须在外键列上添加唯一约束)，(3).通过关联表来保存两个实体之间的连接关系(要模拟一对一关 联必须在每一个外键上添加唯一约束)。&#60;br /&#62;
1.共享主键的一对一关联映射：&#60;br /&#62;
@Entity&#60;br /&#62;
@Table(name=&#34;Test_Body&#34;)&#60;br /&#62;
public class Body {&#60;br /&#62;
   private Integer id;&#60;br /&#62;
   private Heart heart;&#60;br /&#62;
   @Id&#60;br /&#62;
   public Integer getId() {&#60;br /&#62;
      return id;&#60;br /&#62;
   }&#60;br /&#62;
   public void setId(Integer id) {&#60;br /&#62;
      this.id = id;&#60;br /&#62;
   }&#60;br /&#62;
   @OneToOne&#60;br /&#62;
   @PrimaryKeyJoinColumn&#60;br /&#62;
   public Heart getHeart() {&#60;br /&#62;
      return heart;&#60;br /&#62;
   }&#60;br /&#62;
   public void setHeart(Heart heart) {&#60;br /&#62;
      this.heart = heart;&#60;br /&#62;
   }&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
@Table(name=&#34;Test_Heart&#34;)&#60;br /&#62;
public class Heart {&#60;br /&#62;
   private Integer id;&#60;br /&#62;
   @Id&#60;br /&#62;
   public Integer getId() {&#60;br /&#62;
      return id;&#60;br /&#62;
   }&#60;br /&#62;
   public void setId(Integer id) {&#60;br /&#62;
      this.id = id;&#60;br /&#62;
   }&#60;br /&#62;
}&#60;br /&#62;
通过@PrimaryKeyJoinColumn批注定义了一对一关联&#60;/p&#62;
&#60;p&#62;2.使用外键进行实体一对一关联：&#60;br /&#62;
@Entity&#60;br /&#62;
@Table(name=&#34;Test_Trousers&#34;)&#60;br /&#62;
public class Trousers {&#60;br /&#62;
   @Id&#60;br /&#62;
   public Integer id;&#60;br /&#62;
   @OneToOne&#60;br /&#62;
   @JoinColumn(name = &#34;zip_id&#34;)&#60;br /&#62;
   public TrousersZip zip;&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
@Table(name=&#34;Test_TrousersZip&#34;)&#60;br /&#62;
public class TrousersZip {&#60;br /&#62;
   @Id&#60;br /&#62;
   public Integer id;&#60;br /&#62;
   @OneToOne(mappedBy = &#34;zip&#34;)&#60;br /&#62;
   public Trousers trousers;&#60;br /&#62;
}&#60;br /&#62;
上面的例子是指Trousers通过Trousers的外键列zip_id和TrousersZip关联，@JoinColumn批注定义了联接 列，该批注和@Column批注有点类似，但是多了一个名为referencedColumnName的参数。该参数定义了所关联目标实体中的联接列，注 意，当referencedColumnName关联到非主键列的时候，关联的目标类必须实现Serializable，还要注意的是所映像的属性对应单 个列（否则映射无效）&#60;br /&#62;
一对一关联可能是双向的，在双向关联中，有且仅有一端作为主体（owner）端存在：主体端负责维护联接列（即更新），对于不需要维护这种关系的从 表则通过mappedNy属性进行声明。mappedBy的值指向主体的关联属性。例子中，mappedBy的值为zip。最后，不必也不能再在被关联端 （ownedside）定义联接列了，因为已经在主体端声明了。&#60;br /&#62;
如果在主体没有声明@JoinColumn，系统自动进行处理：在主表（owner table）中将创建联接列，列名为：主体的关联属性名+下划线+被关联端的主键列名。上面的例子中是zip_id,因为Trousers中的关联属性名 为zip，TrousersZip的主键是id。&#60;/p&#62;
&#60;p&#62;3.通过关联表定义一对一关联&#60;br /&#62;
@Entity&#60;br /&#62;
@Table(name=&#34;Test_People&#34;)&#60;br /&#62;
public class People {&#60;br /&#62;
   @Id&#60;br /&#62;
   public Integer id;&#60;br /&#62;
   @OneToOne&#60;br /&#62;
   @JoinTable(name =&#34;TestPeoplePassports&#34;,&#60;br /&#62;
      joinColumns =@JoinColumn(name=&#34;people_fk&#34;),&#60;br /&#62;
      inverseJoinColumns =@JoinColumn(name=&#34;passport_fk&#34;)&#60;br /&#62;
   )&#60;br /&#62;
   public Passport passport;&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
@Table(name=&#34;Test_Passport&#34;)&#60;br /&#62;
public class Passport {&#60;br /&#62;
   @Id&#60;br /&#62;
   public Integer id;&#60;br /&#62;
   @OneToOne(mappedBy = &#34;passport&#34;)&#60;br /&#62;
   public People people;&#60;br /&#62;
}&#60;br /&#62;
People通过名为TestPeoplePassports的关联表和Passport关联。该关联表拥有名为passport_fk的外键列， 该外键指向Passport表，该信息定义为inverseJoinColoumns的属性值，而people_fk外键列指向People表，该信息定 义为joinColumns的属性值。&#60;br /&#62;
这种关联可能是双向的，在双向关联中，有且仅有一端作为主体（owner）端存在：主体端负责维护联接列（即更新），对于不需要维护这种关系的从表 则通过mappedNy属性进行声明。mappedBy的值指向主体的关联属性。例子中，mappedBy的值为passport。最后，不必也不能再在 被关联端（ownedside）定义联接列了，因为已经在主体端声明了。&#60;br /&#62;
以上是一对一关联的三种形式，下面介绍多对一关联。&#60;/p&#62;
&#60;p&#62;多对一(Many-to-One)&#60;br /&#62;
使用@ManyToOne批注来实现多对一关联。&#60;br /&#62;
@ManyToOne批注有一个名为targetEntity的参数，该参数定义了目标实体名，通常不需要定义该参数，因为在大部分情况下默认值 (表示关联关系的属性类型)就可以很好的满足需求了。不过下面这种情况下这个参数就显得有意义了：使用接口作为返回值而不是常见的实体。&#60;br /&#62;
@ManyToOne(targetEntity=CompanyImpl.class)&#60;br /&#62;
@JoinColoumn(name=”COPM_ID”)&#60;br /&#62;
Public Company getCompany(){&#60;br /&#62;
   return company;&#60;br /&#62;
}&#60;br /&#62;
多对一的配置方式有两种：(1)通过@JoinColoumn映像(2)通过关联表的方式来映像&#60;br /&#62;
(1)通过@JoinColoumn映射&#60;br /&#62;
SRD Framework中Company,Category例子：&#60;br /&#62;
Company：&#60;br /&#62;
@ManyToOne&#60;br /&#62;
   @JoinColumn(name = &#34;CATEGORY_OPTION_ID&#34;)&#60;br /&#62;
   private Category category = null;&#60;br /&#62;
   Category：&#60;br /&#62;
@DiscriminatorValue(&#34;Category&#34;)&#60;br /&#62;
public class Category extends Option {&#60;br /&#62;
}&#60;br /&#62;
(2)通过关联表映射&#60;br /&#62;
通过@JoinTable批注定义关联表，该关联表包含了指回实体表的外键(通过@JoinTable.joinColoumns)以及指向目标实 体表的外键(通过@JoinTable.inverseJoinColoumns)&#60;br /&#62;
@Entity&#60;br /&#62;
@Table(name=&#34;Test_TreeType&#34;)&#60;br /&#62;
public class TreeType {&#60;br /&#62;
   private Integer id;&#60;br /&#62;
   private String name;&#60;br /&#62;
   private ForestType forestType;&#60;br /&#62;
   @ManyToOne(fetch = FetchType.LAZY)&#60;br /&#62;
   @JoinTable(name=&#34;Test_Tree_Forest&#34;,&#60;br /&#62;
      joinColumns = @JoinColumn(name=&#34;tree_id&#34;),&#60;br /&#62;
      inverseJoinColumns = @JoinColumn(name=&#34;forest_id&#34;) )&#60;br /&#62;
public ForestType getForestType() {// forestType的getter，setter方法必须在这里，否则会出错&#60;br /&#62;
      return forestType;&#60;br /&#62;
   }&#60;br /&#62;
   public void setForestType(ForestType forestType) {&#60;br /&#62;
      this.forestType = forestType;&#60;br /&#62;
   }&#60;br /&#62;
   @Id&#60;br /&#62;
   @GeneratedValue&#60;br /&#62;
   public Integer getId() {&#60;br /&#62;
      return id;&#60;br /&#62;
   }&#60;br /&#62;
   public void setId(Integer id) {&#60;br /&#62;
      this.id = id;&#60;br /&#62;
   }&#60;br /&#62;
   public String getName() {&#60;br /&#62;
      return name;&#60;br /&#62;
   }&#60;br /&#62;
   public void setName(String name) {&#60;br /&#62;
      this.name = name;&#60;br /&#62;
   }&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
@Table(name=&#34;Test_ForestType&#34;)&#60;br /&#62;
public class ForestType {&#60;br /&#62;
   private Integer id;&#60;br /&#62;
   private String name;&#60;br /&#62;
   private Set&#38;lt;TreeType&#38;gt; trees;&#60;br /&#62;
   @OneToMany(mappedBy=&#34;forestType&#34;)&#60;br /&#62;
public Set&#38;lt;TreeType&#38;gt; getTrees() {// trees的getter，setter方法必须在这里，否则会出错&#60;br /&#62;
      return trees;&#60;br /&#62;
   }&#60;br /&#62;
   public void setTrees(Set&#38;lt;TreeType&#38;gt; trees) {&#60;br /&#62;
      this.trees = trees;&#60;br /&#62;
   }&#60;br /&#62;
   @Id @GeneratedValue&#60;br /&#62;
   public Integer getId() {&#60;br /&#62;
      return id;&#60;br /&#62;
   }&#60;br /&#62;
   public void setId(Integer id) {&#60;br /&#62;
      this.id = id;&#60;br /&#62;
   }&#60;br /&#62;
   public String getName() {&#60;br /&#62;
      return name;&#60;br /&#62;
   }&#60;br /&#62;
   public void setName(String name) {&#60;br /&#62;
      this.name = name;&#60;br /&#62;
   }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;一对多(One-to-Many)&#60;br /&#62;
使用@OneToMany批注可定义一对多关联，一对多关联可以是双向关联。&#60;br /&#62;
在EJB3规范中多对一这端几乎总是双向关联中的主体(owner)端，而一对多这端关联批注为@OneToMany(mappedBy...)&#60;br /&#62;
@Entity&#60;br /&#62;
Public class Troop{&#60;br /&#62;
   @OneToMany(mappedBy=”troop”)&#60;br /&#62;
Public Set&#38;lt;Soldier&#38;gt; getSoldiers(){&#60;br /&#62;
......&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
Public class Soldier{&#60;br /&#62;
   @ManyToOne&#60;br /&#62;
   @JoinColumn(name=”troop_fk”)&#60;br /&#62;
Public Troop getTroop(){&#60;br /&#62;
......&#60;br /&#62;
}&#60;br /&#62;
Troop通过troop属性和Soldier建立一对多的双向关联，在mappedBy端不必也不能再定义任何物理映射。&#60;br /&#62;
对于一对多的双向映射，如果要一对多这一端维护关联关系，你需要删除mappedBy元素并将多对一这端的@JoinColoumn的 insertable和updatabel设置为false。这种方案不会得到什么明显的优化，而且还会增加一些附加的UPDATE语句。&#60;/p&#62;
&#60;p&#62;单向：&#60;br /&#62;
通过在被拥有的实体端(owned entity)增加一个外键列来实现一对多单向关联是很少见的，也是不推荐的，建议通过一个联接表来实现这种关联(下面会讲到)。&#60;br /&#62;
@JoinColoumn批注来描述这种单向关联关系&#60;br /&#62;
@Entity&#60;br /&#62;
Public class Customer{&#60;br /&#62;
   @OneToMany&#60;br /&#62;
@JoinColoumn(name=”CUST_ID”)&#60;br /&#62;
Public Set&#38;lt;ticket&#38;gt; getTickets() {&#60;br /&#62;
......&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
Public class Ticket{&#60;br /&#62;
   ...&#60;br /&#62;
}&#60;br /&#62;
Customer通过CUST_ID列和Ticket建立了单向关联关系&#60;br /&#62;
通过关联表处理单向关联：&#60;br /&#62;
通过联接表处理单向一对多关联是首选方式，这种关联通过@JoinTable批注进行描述&#60;br /&#62;
@Entity&#60;br /&#62;
Public class Trainer{&#60;br /&#62;
@OneToMany&#60;br /&#62;
@JoinTable(&#60;br /&#62;
   name = &#34;TrainedMonkeys&#34;,&#60;br /&#62;
   jonColumns = {@JoinColumn(name = &#34;trainer_id&#34;)},&#60;br /&#62;
   inverseJoinColumns = @JoinColumn(name = &#34;monkey_id&#34;)&#60;br /&#62;
   )&#60;br /&#62;
public Set&#38;lt;Monkey&#38;gt; getTrainedMonkeys() {&#60;br /&#62;
      return trainedMonkeys;&#60;br /&#62;
   }&#60;br /&#62;
......&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
public class Monkey {&#60;br /&#62;
...//no bidir&#60;br /&#62;
}&#60;br /&#62;
上面这个例子中，Trainer通过TrainedMonkeys表和Monkey建立了单向关联，其中外键trainer_id关联到 Trainer(joinColoumn),而外键monkey_id关联到Monkey(inversejionColoumns)&#60;br /&#62;
默认处理机制：&#60;br /&#62;
通过联接表来建立单向一对多关联不需要描述任何物理映像，表名由以下三个部分组成：主表(ownertable)表名+从表(the other side table)表名，指向主表的外键名：主表表名+下划线+主表主键列名，指向从表的外键名：主表所对应实体的属性名+下划线+从表主键列名，指向从表的外 键定义为唯一约束，用来表示一对多的关联关系。&#60;br /&#62;
@Entity&#60;br /&#62;
public class Trainer{&#60;br /&#62;
   @OneToMany&#60;br /&#62;
   Public Set&#38;lt;Tiger&#38;gt; getTrainedTigers(){&#60;br /&#62;
... ...&#60;br /&#62;
}&#60;br /&#62;
@Entity&#60;br /&#62;
public class Tiger{&#60;br /&#62;
.. ..//no bidir&#60;br /&#62;
}&#60;br /&#62;
上面这个例子中，Trainer和Tiger通过联接表Trainer_Tiger建立单向关联关系，其中外键trainer_id关联到 Trainer,而外键trainedTigers_id关联到Tiger&#60;/p&#62;
&#60;p&#62;多对多(Many-to-Many)&#60;br /&#62;
使用@ManyToMany批注可定义多对多关联，同时，你也许要通过批注@JoinTable描述关联表和关联条件。如果是双向关联，其中一段必 须定义为Owner，另一端必须定义为inverse(在对关联表进行更新操作时这一端将被忽略)&#60;br /&#62;
@Entity()&#60;br /&#62;
public class Employer implements Serializable {&#60;br /&#62;
   private Integer id;&#60;br /&#62;
   private Collection employees;&#60;br /&#62;
   @ManyToMany(&#60;br /&#62;
targetEntity = org.hibernate.test.annotations.manytomany.Employee.class,&#60;br /&#62;
      cascade = {CascadeType.PERSIST, CascadeType.MERGE}&#60;br /&#62;
   )&#60;br /&#62;
   @JoinTable(&#60;br /&#62;
         name = &#34;EMPLOYER_EMPLOYEE&#34;,&#60;br /&#62;
         joinColumns = {@JoinColumn(name = &#34;EMPER_ID&#34;)},&#60;br /&#62;
         inverseJoinColumns = {@JoinColumn(name = &#34;EMPEE_ID&#34;)}&#60;br /&#62;
   )&#60;br /&#62;
   public Collection getEmployees() {&#60;br /&#62;
      return employees;&#60;br /&#62;
   }&#60;br /&#62;
...&#60;br /&#62;
}&#60;br /&#62;
@Entity()&#60;br /&#62;
public class Employee implements Serializable {&#60;br /&#62;
   @ManyToMany(&#60;br /&#62;
         cascade = {CascadeType.PERSIST, CascadeType.MERGE},&#60;br /&#62;
         mappedBy = &#34;employees&#34;&#60;br /&#62;
         targetEntity = Employer.class&#60;br /&#62;
   )&#60;br /&#62;
public Collection&#38;lt;Employer&#38;gt; getEmployers() {&#60;br /&#62;
      return employers;&#60;br /&#62;
   }&#60;br /&#62;
.. ..&#60;br /&#62;
}&#60;br /&#62;
@JoinTable批注定义了联接表的表名，联接列数组，以及invers联接列数组，后者是关联表中关联到Employee主键的列(the “other side”)。&#60;br /&#62;
被关联端不必也不能描述物理映射：只需要一个简单的mappedBy参数，该参数包含了主体端的属性名，这样就绑定了双方的关系。&#60;br /&#62;
默认值：&#60;br /&#62;
和其它许多批注一样，在多对多关联中很多值是自动生成，党双向多对多关联中没有定义任何物理映射时，Hibernate根据以下规则生成相应的值， 关联表名：主表表名+下划线+从表表名，关联到主表的外键名：主表名+下划线+主表中的主键列名，关联到从表的外键名：主表中用于关联的属性名+下划线+ 从表的主键列名，以上规则对于双向一对多关联同样一样。
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "log4j配置日志信息输出目的地"</title>
<link>http://www.ll19.com/bb/topic/107#post-107</link>
<pubDate>Sun, 03 Jan 2010 16:13:23 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">107@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;log4j.appender.appenderName = fully.qualified.name.of.appender.class  //&#60;br /&#62;
&#34;fully.qualified.name.of.appender.class&#34; 可以指定下面五个目的地中的一个：&#60;br /&#62;
1.org.apache.log4j.ConsoleAppender（控制台）&#60;br /&#62;
2.org.apache.log4j.FileAppender（文件）&#60;br /&#62;
3.org.apache.log4j.DailyRollingFileAppender（每天产生一个日志文件）&#60;br /&#62;
4.org.apache.log4j.RollingFileAppender（文件大小到达指定尺寸的时候产生一个新的文 件）&#60;br /&#62;
5.org.apache.log4j.WriterAppender（将日志信息以流格式发送到任意指定的地方）&#60;/p&#62;
&#60;p&#62;1.ConsoleAppender选项&#60;br /&#62;
Threshold=WARN:指定日志消息的输出最低层次。&#60;br /&#62;
ImmediateFlush=true:默认值是true,意谓着所有的消息都会被立即输出。&#60;br /&#62;
Target=System.err：默认情况下是：System.out,指定输出控制台 &#60;/p&#62;
&#60;p&#62;2.FileAppender 选项&#60;br /&#62;
Threshold=WARN:指定日志消息的输出最低层次。&#60;br /&#62;
ImmediateFlush=true:默认值是true,意谓着所有的消息都会被立即输出。&#60;br /&#62;
File=mylog.txt:指定消息输出到mylog.txt文件。&#60;br /&#62;
Append=false:默认值是true,即将消息增加到指定文件中，false指将消息覆盖指定的文件内容。 &#60;/p&#62;
&#60;p&#62;3.DailyRollingFileAppender 选项&#60;br /&#62;
Threshold=WARN:指定日志消息的输出最低层次。&#60;br /&#62;
ImmediateFlush=true:默认值是true,意谓着所有的消息都会被立即输出。&#60;br /&#62;
File=mylog.txt:指定消息输出到 mylog.txt文件。&#60;br /&#62;
Append=false:默认值是true,即将消息增加到指定文件中，false指将消息覆盖指定的文件内容。&#60;br /&#62;
DatePattern='.'yyyy-ww:每周滚动一次文件，即每周产生一个新的文件。当然也可以指定按月、周、天、时和分。即对应的格式如下：&#60;br /&#62;
1)'.'yyyy-MM: 每月&#60;br /&#62;
2)'.'yyyy-ww: 每周&#60;br /&#62;
3)'.'yyyy-MM-dd: 每天&#60;br /&#62;
4)'.'yyyy-MM-dd-a: 每天两次&#60;br /&#62;
5)'.'yyyy-MM-dd-HH: 每小时&#60;br /&#62;
6)'.'yyyy-MM-dd-HH-mm: 每分钟 &#60;/p&#62;
&#60;p&#62;4.RollingFileAppender 选项&#60;br /&#62;
Threshold=WARN:指定日志消息的输出最低层次。&#60;br /&#62;
ImmediateFlush=true:默认值是true,意谓着所有的消息都会被立即输出。&#60;br /&#62;
File=mylog.txt:指定消息输出到mylog.txt文件。&#60;br /&#62;
Append=false:默认值是true,即将消息增加到指定文件中，false指将消息覆盖指定的文件内容。&#60;br /&#62;
MaxFileSize=100KB: 后缀可以是KB, MB 或者是 GB. 在日志文件到达该大小时，将会自动滚动，即将原来的内容移到mylog.log.1文件。&#60;br /&#62;
MaxBackupIndex=2:指定可以产生的滚动文件的最大数。
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "Hibernate操作BLOB"</title>
<link>http://www.ll19.com/bb/topic/106#post-106</link>
<pubDate>Sun, 03 Jan 2010 16:10:53 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">106@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;这是Cat对象定义&#60;br /&#62;
　　package com.fankai;&#60;br /&#62;
　　import java.sql.Blob;&#60;br /&#62;
　　public class Cat {&#60;br /&#62;
　　private String id;&#60;br /&#62;
　　private String name;&#60;br /&#62;
　　private char sex;&#60;br /&#62;
　　private float weight;&#60;br /&#62;
　　private Blob image;&#60;br /&#62;
　　public Cat() { }&#60;br /&#62;
　　public String getId() { return id; }&#60;br /&#62;
　　public void setId(String id) { this.id = id; }&#60;br /&#62;
　　public String getName() { return name; }&#60;br /&#62;
　　public void setName(String name) { this.name = name; }&#60;br /&#62;
　　public char getSex() { return sex; }&#60;br /&#62;
　　public void setSex(char sex) { this.sex = sex; }&#60;br /&#62;
　　public float getWeight() { return weight; }&#60;br /&#62;
　　public void setWeight(float weight) { this.weight = weight; }&#60;br /&#62;
　　public Blob getImage() { return image; }&#60;br /&#62;
　　public void setImage(Blob image) { this.image = image;}&#60;br /&#62;
　　} &#60;/p&#62;
&#60;p&#62;　　这是Cat.hbm.xml &#60;/p&#62;
&#60;p&#62;　　＜?xml version=&#34;1.0&#34;?＞&#60;br /&#62;
　　＜!DOCTYPE hibernate-mapping SYSTEM &#34;http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd&#34;＞ &#60;/p&#62;
&#60;p&#62;　　＜hibernate-mapping＞&#60;br /&#62;
　　＜class name=&#34;com.fankai.Cat&#34; table=&#34;cat&#34;＞&#60;br /&#62;
　　＜!--jcs-cache usage=&#34;read-only&#34;/--＞&#60;br /&#62;
　　＜id name=&#34;id&#34; unsaved-value=&#34;null&#34;＞&#60;br /&#62;
　　＜generator class=&#34;uuid.hex&#34;/＞&#60;br /&#62;
　　＜/id＞&#60;br /&#62;
　　＜property name=&#34;name&#34; length=&#34;16&#34; not-null=&#34;true&#34;/＞&#60;br /&#62;
　　＜property name=&#34;sex&#34; length=&#34;1&#34; not-null=&#34;true&#34;/＞&#60;br /&#62;
　　＜property name=&#34;weight&#34; /＞&#60;br /&#62;
　　＜property name=&#34;image&#34; /＞&#60;br /&#62;
　　＜/class＞&#60;br /&#62;
　　＜/hibernate-mapping＞ &#60;/p&#62;
&#60;p&#62;　　下面是完整的用Hibernate写入Blob的例子，相比JDBC，已经简单轻松多了，也不用写那些Oracle特殊的sql了： &#60;/p&#62;
&#60;p&#62;　　package com.fankai;&#60;br /&#62;
　　import java.sql.Blob;&#60;br /&#62;
　　import net.sf.hibernate.*;&#60;br /&#62;
　　import oracle.sql.*;&#60;br /&#62;
　　import java.io.*;&#60;br /&#62;
　　public class TestCatHibernate {&#60;br /&#62;
　　public static void testBlob() {&#60;br /&#62;
　　Session s = null;&#60;br /&#62;
　　byte[] buffer = new byte[1];&#60;br /&#62;
　　buffer[0] = 1;&#60;br /&#62;
　　try {&#60;br /&#62;
　　　SessionFactory sf = HibernateSessionFactory.getSessionFactory();&#60;br /&#62;
　　　s = sf.openSession();&#60;br /&#62;
　　　Transaction tx = s.beginTransaction();&#60;br /&#62;
　　　Cat c = new Cat();&#60;br /&#62;
　　　c.setName(&#34;Robbin&#34;);&#60;br /&#62;
　　　c.setImage(Hibernate.createBlob(buffer));&#60;br /&#62;
　　　s.save(c);&#60;br /&#62;
　　　s.flush();&#60;br /&#62;
　　　s.refresh(c, LockMode.UPGRADE);&#60;br /&#62;
　　　BLOB blob = (BLOB) c.getImage();&#60;br /&#62;
　　　OutputStream out = blob.getBinaryOutputStream();&#60;br /&#62;
　　　String fileName = &#34;oraclejdbc.jar&#34;;&#60;br /&#62;
　　　File f = new File(fileName);&#60;br /&#62;
　　　FileInputStream fin = new FileInputStream(f);&#60;br /&#62;
　　　int count = -1, total = 0;&#60;br /&#62;
　　　byte[] data = new byte[(int)fin.available()];&#60;br /&#62;
　　　fin.read(data);&#60;br /&#62;
　　　out.write(data);&#60;br /&#62;
　　　fin.close();&#60;br /&#62;
　　　out.close();&#60;br /&#62;
　　　s.flush();&#60;br /&#62;
　　　tx.commit();&#60;br /&#62;
　　} catch (Exception e) {&#60;br /&#62;
　　　System.out.println(e.getMessage());&#60;br /&#62;
　　} finally {&#60;br /&#62;
　　　if (s != null)&#60;br /&#62;
　　　try {&#60;br /&#62;
　　　　s.close();&#60;br /&#62;
　　　} catch (Exception e) {}&#60;br /&#62;
　　}&#60;br /&#62;
　　}&#60;br /&#62;
　　}
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "JDBC实现oracle blob 出库入库"</title>
<link>http://www.ll19.com/bb/topic/105#post-105</link>
<pubDate>Sun, 03 Jan 2010 16:09:40 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">105@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;JDBC实现oracle blob 出库入库&#60;br /&#62;
1，首先建一个足够简单的表imageTable&#60;br /&#62;
      id         varchar（20）&#60;br /&#62;
      image   blob&#60;br /&#62;
2，blob入库&#60;br /&#62;
      拷贝Sunset.jpg图片在C盘根目录下      &#60;/p&#62;
&#60;p&#62;一般是先通过select  ... for update锁定blob列，然后写入blob值，然后提交。要用到特定的Oracle BLOB类。&#60;/p&#62;
&#60;p&#62; 1       DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());&#60;br /&#62;
 2       Connection conn = DriverManager.getConnection(&#34;jdbc:oracle:thin:@localhost:1521:beyondduke&#34;,&#34;duke&#34;,&#34;duke&#34;);&#60;br /&#62;
 3       conn.setAutoCommit(false);&#60;br /&#62;
 4       BLOB blob = null;&#60;br /&#62;
 5       PreparedStatement pstmt = conn.prepareStatement(&#34;insert into imageTable(id,image) values(?,empty_blob())&#34;);&#60;br /&#62;
 6       pstmt.setString(1,&#34;10001&#34;);&#60;br /&#62;
 7       pstmt.executeUpdate();&#60;br /&#62;
 8       pstmt.close();&#60;br /&#62;
 9       pstmt = conn.prepareStatement(&#34;select content from imageTable where id= ? for update&#34;);&#60;br /&#62;
10       pstmt.setString(1,&#34;10001&#34;);&#60;br /&#62;
11       ResultSet rs = pstmt.executeQuery();&#60;br /&#62;
12      if (rs.next()) blob = (BLOB) rs.getBlob(1);&#60;br /&#62;
13       String fileName = &#34;c://Sunset.jpg&#34;;&#60;br /&#62;
14       File f = new File(fileName);&#60;br /&#62;
15       FileInputStream fin = new FileInputStream(f);&#60;br /&#62;
16       System.out.println(&#34;file size = &#34; + fin.available());&#60;br /&#62;
17       pstmt = conn.prepareStatement(&#34;update imageTable set image=? where id=?&#34;);&#60;br /&#62;
18       OutputStream out = blob.getBinaryOutputStream();&#60;br /&#62;
19        byte[] data = new byte[(int)fin.available()];&#60;br /&#62;
20       fin.read(data);&#60;br /&#62;
21       out.write(data);&#60;br /&#62;
22       out.close();&#60;br /&#62;
23       fin.close();&#60;br /&#62;
24&#60;br /&#62;
25       pstmt.setBlob(1,blob);&#60;br /&#62;
26       pstmt.setString(2,&#34;fankai&#34;);&#60;br /&#62;
27&#60;br /&#62;
28       pstmt.executeUpdate();&#60;br /&#62;
29       pstmt.close();&#60;br /&#62;
30&#60;br /&#62;
31       conn.commit();&#60;br /&#62;
32       conn.close(); &#60;/p&#62;
&#60;p&#62;浏览数据库的数据，发现image项中数据大小与图片大小 一致，说明入库了！&#60;/p&#62;
&#60;p&#62; 1    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());&#60;br /&#62;
 2    Connection conn = DriverManager.getConnection(            &#34;jdbc:oracle:thin:@localhost:1521:beyondduke&#34;, &#34;duke&#34;,&#34;duke&#34;);&#60;br /&#62;
          conn.setAutoCommit(&#60;br /&#62;
false);&#60;br /&#62;
 3     Statement stmt = conn.createStatement();&#60;br /&#62;
 4  /* 查询BLOB对象 */&#60;br /&#62;
 5     ResultSet rs = stmt.executeQuery(&#34;SELECT content FROM javatest WHERE id='1001'&#34;);&#60;br /&#62;
 6  while (rs.next()) {&#60;br /&#62;
 7  /* 取出此BLOB对象 */&#60;br /&#62;
 8     oracle.sql.BLOB blob = (oracle.sql.BLOB) rs.getBlob(&#34;image&#34;);&#60;br /&#62;
 9   BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(&#34;d://Sunset.jpg&#34;));&#60;br /&#62;
           BufferedInputStream in = new BufferedInputStream(blob    .getBinaryStream());&#60;br /&#62;
10     int c;&#60;br /&#62;
11  while ((c = in.read()) != -1) { out.write(c);&#60;br /&#62;
12    }&#60;br /&#62;
13    in.close();&#60;br /&#62;
14    out.close();&#60;br /&#62;
15    rs.close();&#60;br /&#62;
16    stmt.close();&#60;br /&#62;
17    conn.close();&#60;br /&#62;
18 &#60;/p&#62;
&#60;p&#62;检查D盘根目录，会发现Sunset.jpg文件，跟C盘下是一样的，说明入库出库成 功！
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "LONG CLOB BLOB LONG RAW 区别"</title>
<link>http://www.ll19.com/bb/topic/104#post-104</link>
<pubDate>Sun, 03 Jan 2010 16:08:22 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">104@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;要保存图片、文本文件、Word文件各自最好用哪种数据类型?&#60;br /&#62;
BLOB最好，LONG　RAW也不错，但Long是 oracle将要废弃的类型，因此建议用BLOB。&#60;/p&#62;
&#60;p&#62;个人理解，基本上来说可以理解LONG存储大于4000的字符 而BLOB用于存储附件流的二进制数据&#60;/p&#62;
&#60;p&#62; LONG: 可变长的字符串数据，最长2G，LONG具有VARCHAR2列的特性，可以存储长文本一个表中最多一个LONG列&#60;br /&#62;
LONG RAW: 可变长二进制数据，最长2G（注意是二进制不是字符）&#60;/p&#62;
&#60;p&#62;　　CLOB: 字符大对象Clob 用来存储单字节的字符数据&#60;br /&#62;
　　NCLOB: 用来存储多字节的字符数据&#60;br /&#62;
BLOB: 用于存储二进制数据&#60;/p&#62;
&#60;p&#62;ORACLE建议在存储大字段使用LOB型&#60;/p&#62;
&#60;p&#62;　　BFILE: 存储在文件中的二进制数据，这个文件中的数据只能被只读访。但该文件不包含在数据库内。&#60;/p&#62;
&#60;p&#62;bfile字段实际的文件存储在文件系统中,字段中存储的是文件定位指针.bfile对oracle来说是只读的,也不参与事务性控制和数据恢复.&#60;br /&#62;
　　&#60;br /&#62;
　　CLOB，NCLOB，BLOB都是内部的LOB(Large Object)类型，最长4G，没有LONG只能有一列的限制
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "JAVA对EXCEL解析"</title>
<link>http://www.ll19.com/bb/topic/103#post-103</link>
<pubDate>Sun, 03 Jan 2010 16:07:19 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">103@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;package testexcel;&#60;br /&#62;
import java.io.FileInputStream;&#60;br /&#62;
import java.io.FileOutputStream;&#60;br /&#62;
import java.text.DecimalFormat;&#60;br /&#62;
import org.apache.poi.hssf.usermodel.HSSFCell;&#60;br /&#62;
import org.apache.poi.hssf.usermodel.HSSFRow;&#60;br /&#62;
import org.apache.poi.hssf.usermodel.HSSFSheet;&#60;br /&#62;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;&#60;br /&#62;
/**&#60;br /&#62;
*&#60;br /&#62;
* @author shiwt&#60;br /&#62;
*&#60;br /&#62;
* java读取excel文件&#60;br /&#62;
*&#60;br /&#62;
* 一个Excel文件的层次：Excel文件-&#38;gt;工作表-&#38;gt;行-&#38;gt;单元格 对应到POI中，为：workbook-&#38;gt;sheet-&#38;gt;row-&#38;gt;cell&#60;br /&#62;
*&#60;br /&#62;
*/&#60;br /&#62;
public class POItest {&#60;br /&#62;
public static String outputFile = &#34;f:\\test\\tels.xls&#34;;&#60;br /&#62;
public static String fileToBeRead = &#34;f:\\test\\tels.xls&#34;;&#60;br /&#62;
public void CreateExcel() {&#60;br /&#62;
try {&#60;br /&#62;
   // 创建新的Excel 工作簿&#60;br /&#62;
   HSSFWorkbook workbook = new HSSFWorkbook();&#60;br /&#62;
   // 在Excel工作簿中建一工作表，其名为缺省值&#60;br /&#62;
   // 如要新建一名为&#34;效益指标&#34;的工作表，其语句为：&#60;br /&#62;
   // HSSFSheet sheet = workbook.createSheet(&#34;效益指标&#34;);&#60;br /&#62;
   HSSFSheet sheet = workbook.createSheet();&#60;br /&#62;
   // 在索引0的位置创建行（最顶端的行）&#60;br /&#62;
   HSSFRow row = sheet.createRow((short) 0);&#60;br /&#62;
   //在索引0的位置创建单元格（左上端）&#60;br /&#62;
   HSSFCell cell = row.createCell((short) 0);&#60;br /&#62;
   // 定义单元格为字符串类型&#60;br /&#62;
   cell.setCellType(HSSFCell.CELL_TYPE_STRING);&#60;br /&#62;
   // 在单元格中输入一些内容&#60;br /&#62;
   cell.setCellValue(&#34;sweater&#34;);&#60;br /&#62;
   // 新建一输出文件流&#60;br /&#62;
   FileOutputStream fOut = new FileOutputStream(outputFile);&#60;br /&#62;
   // 把相应的Excel 工作簿存盘&#60;br /&#62;
   workbook.write(fOut);&#60;br /&#62;
   fOut.flush();&#60;br /&#62;
   // 操作结束，关闭文件&#60;br /&#62;
   fOut.close();&#60;br /&#62;
   System.out.println(&#34;文件生成...&#34;);&#60;br /&#62;
} catch (Exception e) {&#60;br /&#62;
   System.out.println(&#34;已运行 xlCreate() : &#34; + e);&#60;br /&#62;
}&#60;br /&#62;
}&#60;br /&#62;
/**&#60;br /&#62;
*&#60;br /&#62;
* 读取excel，遍历各个小格获取其中信息，并判断其是否是手机号码，并对正确的手机号码进行显示&#60;br /&#62;
* 注意： 1.sheet， 以0开始，以workbook.getNumberOfSheets()-1结束 2.row，&#60;br /&#62;
* 以0开始(getFirstRowNum)，以getLastRowNum结束 3.cell，&#60;br /&#62;
* 以0开始(getFirstCellNum)，以getLastCellNum结束, 结束的数目不知什么原因与显示的长度不同，可能会偏长&#60;br /&#62;
*&#60;br /&#62;
*/&#60;br /&#62;
public void readExcel() {&#60;br /&#62;
//将被表示成1.3922433397E10的手机号转化为13922433397,不一定是最好的转换方法&#60;br /&#62;
DecimalFormat df = new DecimalFormat(&#34;#&#34;);&#60;br /&#62;
try {&#60;br /&#62;
   // 创建对Excel工作簿文件的引用&#60;br /&#62;
   HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(fileToBeRead));&#60;br /&#62;
   /**&#60;br /&#62;
    *获取sheet的个数&#60;br /&#62;
    *workbook.getNumberOfSheets()&#60;br /&#62;
    **/&#60;br /&#62;
   //System.out.println(&#34;===SheetsNum===&#34; + workbook.getNumberOfSheets());//获取sheet数&#60;/p&#62;
&#60;p&#62;   for (int numSheets = 0; numSheets &#38;lt; workbook.getNumberOfSheets(); numSheets++) {&#60;br /&#62;
    if (null != workbook.getSheetAt(numSheets)) {&#60;br /&#62;
     HSSFSheet aSheet = workbook.getSheetAt(numSheets);//获得一个sheet&#60;br /&#62;
     //System.out.println(&#34;+++getFirstRowNum+++&#34; +&#60;br /&#62;
     // aSheet.getFirstRowNum());//&#60;br /&#62;
     //System.out.println(&#34;+++getLastRowNum+++&#34; +&#60;br /&#62;
     // aSheet.getLastRowNum());&#60;br /&#62;
     for (int rowNumOfSheet = 0; rowNumOfSheet &#38;lt;= aSheet&#60;br /&#62;
       .getLastRowNum(); rowNumOfSheet++) {&#60;br /&#62;
      if (null != aSheet.getRow(rowNumOfSheet)) {&#60;br /&#62;
       HSSFRow aRow = aSheet.getRow(rowNumOfSheet);&#60;br /&#62;
       //System.out.println(&#34;&#38;gt;&#38;gt;&#38;gt;getFirstCellNum&#38;lt;&#38;lt;&#38;lt;&#34;+&#60;br /&#62;
       // aRow.getFirstCellNum());&#60;br /&#62;
       //System.out.println(&#34;&#38;gt;&#38;gt;&#38;gt;getLastCellNum&#38;lt;&#38;lt;&#38;lt;&#34;+&#60;br /&#62;
       // aRow.getLastCellNum());&#60;br /&#62;
       for (short cellNumOfRow = 0; cellNumOfRow &#38;lt;= aRow&#60;br /&#62;
         .getLastCellNum(); cellNumOfRow++) {&#60;br /&#62;
        if (null != aRow.getCell(cellNumOfRow)) {&#60;br /&#62;
         HSSFCell aCell = aRow.getCell(cellNumOfRow);&#60;br /&#62;
         int cellType = aCell.getCellType();&#60;br /&#62;
         //System.out.println(cellType);&#60;br /&#62;
         switch (cellType) {&#60;br /&#62;
         case &#60;a href=&#34;0://Numeric&#34; rel=&#34;nofollow&#34;&#62;0://Numeric&#60;/a&#62;&#60;br /&#62;
          String strCell = df.format(aCell&#60;br /&#62;
            .getNumericCellValue());&#60;br /&#62;
           System.out.println(strCell);&#60;/p&#62;
&#60;p&#62;          break;&#60;br /&#62;
         case &#60;a href=&#34;1://String&#34; rel=&#34;nofollow&#34;&#62;1://String&#60;/a&#62;&#60;br /&#62;
          strCell = aCell.getStringCellValue();&#60;br /&#62;
           System.out.println(strCell);&#60;/p&#62;
&#60;p&#62;          break;&#60;br /&#62;
         default:&#60;br /&#62;
         //System.out.println(&#34;格式不对不读&#34;);//其它格式的数据&#60;br /&#62;
         }&#60;br /&#62;
        }&#60;br /&#62;
       }&#60;br /&#62;
      }&#60;br /&#62;
     }&#60;br /&#62;
    }&#60;br /&#62;
   }&#60;br /&#62;
} catch (Exception e) {&#60;br /&#62;
   System.out.println(&#34;ReadExcelError&#34; + e);&#60;br /&#62;
}&#60;br /&#62;
}&#60;br /&#62;
public static void main(String[] args) {&#60;br /&#62;
POItest poi = new POItest();&#60;br /&#62;
//poi.CreateExcel();&#60;br /&#62;
poi.readExcel();&#60;br /&#62;
}&#60;br /&#62;
}
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "equalsIgnoreCase"</title>
<link>http://www.ll19.com/bb/topic/102#post-102</link>
<pubDate>Sun, 03 Jan 2010 16:05:15 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">102@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;boolean equals(Object anObject)&#60;br /&#62;
          比较此字符串与指定的对象。&#60;br /&#62;
boolean equalsIgnoreCase(String anotherString)&#60;br /&#62;
          将此 String 与另一个 String 进行比较，不考虑大小写。
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "ArrayList的排序"</title>
<link>http://www.ll19.com/bb/topic/101#post-101</link>
<pubDate>Sun, 03 Jan 2010 16:04:03 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">101@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;package com.ll19.util;&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
 * - 19. - ArrayList的排序&#60;br /&#62;
 *&#60;br /&#62;
 * @author &#60;a href=&#34;http://www.LL19.com/&#34;&#62;LL19.com&#60;/a&#62;&#60;br /&#62;
 * @version 1.0&#60;br /&#62;
 */&#60;/p&#62;
&#60;p&#62;import java.util.ArrayList;&#60;br /&#62;
import java.util.Collections;&#60;br /&#62;
import java.util.Comparator;&#60;/p&#62;
&#60;p&#62;public class ListPX implements Comparator&#38;lt;String&#38;gt; {&#60;/p&#62;
&#60;p&#62;	private final static int DOWM = -1;&#60;/p&#62;
&#60;p&#62;	private int state;&#60;/p&#62;
&#60;p&#62;	public ListPX(int state) {&#60;br /&#62;
		this.state = state;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	public ListPX() {&#60;/p&#62;
&#60;p&#62;	}&#60;/p&#62;
&#60;p&#62;	public int compare(String o1, String o2) {&#60;br /&#62;
		if (state == ListPX.DOWM) {&#60;br /&#62;
			return sortDown(o1, o2);&#60;br /&#62;
		}&#60;br /&#62;
		return sortUp(o1, o2);&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	private int sortUp(String o1, String o2) {&#60;br /&#62;
		if (o1.compareTo(o2) &#38;lt; 0) {&#60;br /&#62;
			return -1;&#60;br /&#62;
		} else if (o1.compareTo(o2) &#38;gt; 0) {&#60;br /&#62;
			return 1;&#60;br /&#62;
		} else {&#60;br /&#62;
			return 0;&#60;br /&#62;
		}&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	private int sortDown(String o1, String o2) {&#60;br /&#62;
		if (o1.compareTo(o2) &#38;gt; 0) {&#60;br /&#62;
			return -1;&#60;br /&#62;
		} else if (o1.compareTo(o2) &#38;lt; 0) {&#60;br /&#62;
			return 1;&#60;br /&#62;
		} else {&#60;br /&#62;
			return 0;&#60;br /&#62;
		}&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	public static void main(String[] args) {&#60;br /&#62;
		ArrayList&#38;lt;String&#38;gt; array = new ArrayList&#38;lt;String&#38;gt;();&#60;br /&#62;
		array.add(&#34;000001&#34;);&#60;br /&#62;
		array.add(&#34;000003&#34;);&#60;br /&#62;
		array.add(&#34;000005&#34;);&#60;br /&#62;
		array.add(&#34;000004&#34;);&#60;br /&#62;
		array.add(&#34;000002&#34;);&#60;br /&#62;
		Collections.sort(array, new ListPX(ListPX.DOWM));&#60;/p&#62;
&#60;p&#62;		for (String str : array) {&#60;br /&#62;
			System.out.println(str);&#60;br /&#62;
		}&#60;br /&#62;
	}&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;下面是一个高级排序&#60;br /&#62;
------------------------------------------------&#60;/p&#62;
&#60;p&#62;package com.ll19.util;&#60;/p&#62;
&#60;p&#62;import java.util.Comparator;&#60;/p&#62;
&#60;p&#62;public class Mycomparator implements Comparator {&#60;/p&#62;
&#60;p&#62;	public int compare(Object o1, Object o2) {&#60;br /&#62;
		Person p1 = (Person) o1;&#60;br /&#62;
		Person p2 = (Person) o2;&#60;br /&#62;
		if (p1.age &#38;lt; p2.age)&#60;br /&#62;
			return 1;&#60;br /&#62;
		else&#60;br /&#62;
			return 0;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;package com.ll19.util;&#60;/p&#62;
&#60;p&#62;public class Person {&#60;br /&#62;
	String name;&#60;br /&#62;
	int age;&#60;/p&#62;
&#60;p&#62;	public Person(String name, int age) {&#60;br /&#62;
		this.name = name;&#60;br /&#62;
		this.age = age;&#60;/p&#62;
&#60;p&#62;	}&#60;/p&#62;
&#60;p&#62;	public int getAge() {&#60;br /&#62;
		return age;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	public void setAge(int age) {&#60;br /&#62;
		this.age = age;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	public String getName() {&#60;br /&#62;
		return name;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	public void setName(String name) {&#60;br /&#62;
		this.name = name;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;package com.ll19.util;&#60;/p&#62;
&#60;p&#62;import java.util.ArrayList;&#60;br /&#62;
import java.util.Collections;&#60;br /&#62;
import java.util.Comparator;&#60;/p&#62;
&#60;p&#62;public class ListSort {&#60;br /&#62;
	public static void main(String[] args) {&#60;br /&#62;
		ArrayList list = new ArrayList();&#60;br /&#62;
		list.add(new Person(&#34;lcl&#34;, 28));&#60;br /&#62;
		list.add(new Person(&#34;fx&#34;, 23));&#60;br /&#62;
		list.add(new Person(&#34;wqx&#34;, 29));&#60;br /&#62;
		Comparator comp = new Mycomparator();&#60;br /&#62;
		Collections.sort(list, comp);&#60;br /&#62;
		for (int i = 0; i &#38;lt; list.size(); i++) {&#60;br /&#62;
			Person p = (Person) list.get(i);&#60;br /&#62;
			System.out.println(p.getName());&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;	}&#60;/p&#62;
&#60;p&#62;}
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "System.Properties记录"</title>
<link>http://www.ll19.com/bb/topic/100#post-100</link>
<pubDate>Sun, 03 Jan 2010 16:03:07 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">100@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;System.Properties&#60;/p&#62;
&#60;p&#62;System可以有对标准输入，标准输出，错误输出流；对外部定义的属性和环境变量的访问；加载文件和库的方法；还有快速复制数组的一部分的实用方法。&#60;/p&#62;
&#60;p&#62;System.getProperties()可以确定当前的系统属性,返回值是一个Properties;&#60;br /&#62;
System.load(String filename)等同于：System.getProperties().load(String filename)它们的作用是可以从作为动态库德本地文件系统中指定的文件名加载代码文件。&#60;/p&#62;
&#60;p&#62;System.setProperties(Properties propes):将系统属性设置为Properties参数；&#60;br /&#62;
System.setProperties(String key,String value)等同于System.getProperties().setProperties(String key,String value):设置指定键指示的系统属性 似乎类似于WEB的APPLICATION&#60;/p&#62;
&#60;p&#62;对于在程序中如果我们想得到一个资源文件中对应的键值对的内容，可以有两种方法：&#60;/p&#62;
&#60;p&#62;1）使用Properties的load方法，将这个文件先加载进来，之后使用getProperty方法将对应键的值得到，比如：&#60;br /&#62;
System.getProperties().load(&#34;System.Properties.txt&#34;);先加载System.Properties.txt文件&#60;br /&#62;
System.getProperties().getProperty(&#34;DBType&#34;);后将文件中键为DBType的值得到。&#60;/p&#62;
&#60;p&#62;2）使用第一种方法键对应的值得灵活性比较大。还有一种方法是将不从文件中得到键对应的值。在程序中去设一个属性，比如：&#60;br /&#62;
System.getProperties().setProperty(&#34;DBType&#34;,&#34;SQLServer&#34;);先设置一个键位DBType的属性&#60;br /&#62;
System.getProperties().getProperty(&#34;DBType&#34;);后通过getProperty方法得到DBType的值。&#60;/p&#62;
&#60;p&#62;另外使用Properties.getProperty方法的参数也可以使用系统的一些环境变量，列表如下：&#60;br /&#62;
Key                      Meaning&#60;br /&#62;
-------------------      ------------------------------&#60;br /&#62;
&#34;file.separator&#34;         File separator (e.g., &#34;/&#34;)&#60;br /&#62;
&#34;java.class.path&#34;        Java classpath&#60;br /&#62;
&#34;java.class.version&#34;     Java class version number&#60;br /&#62;
&#34;java.home&#34;              Java installation directory&#60;br /&#62;
&#34;java.vendor&#34;            Java vendor-specific string&#60;/p&#62;
&#60;p&#62;&#34;java.vendor.url&#34;        Java vendor URL&#60;br /&#62;
&#34;java.version&#34;           Java version number&#60;br /&#62;
&#34;line.separator&#34;         Line separator&#60;br /&#62;
&#34;os.arch&#34;                Operating system architecture&#60;br /&#62;
&#34;os.name&#34;                Operating system name&#60;/p&#62;
&#60;p&#62;&#34;path.separator&#34;         Path separator (e.g., &#34;:&#34;)&#60;br /&#62;
&#34;user.dir&#34;               User's current working directory&#60;br /&#62;
&#34;user.home&#34;              User home directory&#60;br /&#62;
&#34;user.name&#34;              User account name&#60;/p&#62;
&#60;p&#62;使用其中的key可以得到一些属性，供我们在程序中使用
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "关于serialVersionUID"</title>
<link>http://www.ll19.com/bb/topic/99#post-99</link>
<pubDate>Sun, 03 Jan 2010 16:02:05 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">99@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;SERVLET经常会提示需要生成serialVersionUID&#60;/p&#62;
&#60;p&#62;serialVersionUID  用来表明类的不同版本间的兼容性&#60;/p&#62;
&#60;p&#62;简单来说，Java的序列化机制是通过在运行时判断类的serialVersionUID来验证版本一致性的。在进行反序列化时，JVM会把传来的字节流中的serialVersionUID与本地相应实体（类）的serialVersionUID进行比较，如果相同就认为是一致的，可以进行反序列化，否则就会出现序列化版本不一致的异常。&#60;/p&#62;
&#60;p&#62;当实现java.io.Serializable接口的实体（类）没有显式地定义一个名为serialVersionUID，类型为long的变量时，Java序列化机制会根据编译的class自动生成一个serialVersionUID作序列化版本比较用，这种情况下，只有同一次编译生成的 class才会生成相同的serialVersionUID 。&#60;/p&#62;
&#60;p&#62;如果我们不希望通过编译来强制划分软件版本，即实现序列化接口的实体能够兼容先前版本，未作更改的类，就需要显式地定义一个名为serialVersionUID，类型为long的变量，不修改这个变量值的序列化实体都可以相互进行串行化和反串行化。
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "使用urlencode"</title>
<link>http://www.ll19.com/bb/topic/98#post-98</link>
<pubDate>Sun, 03 Jan 2010 16:01:02 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">98@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;使用urlencode&#60;br /&#62;
　　UrlEncode&#60;br /&#62;
　　将字符串以 URL 编码。&#60;br /&#62;
　　返回值: 字符串&#60;br /&#62;
　　函数种类: 编码处理&#60;br /&#62;
　　内容说明&#60;br /&#62;
　　本函数将字符串以 URL 编码。例如空格就会变成加号。Homepage 中 form 资料传送就是用 urlencode 编码后再送出。&#60;br /&#62;
　　ASP中的用法:&#60;br /&#62;
　　Server.URLEncode(&#34;内容&#34;)&#60;br /&#62;
　　例:&#60;br /&#62;
　　&#38;lt;%&#60;br /&#62;
　　response.write Server.UrlEncode(&#34;七七IT中国&#34;)&#60;br /&#62;
　　%&#38;gt;&#60;br /&#62;
　　PHP中的用法:&#60;br /&#62;
　　urlencode(&#34;内容&#34;);&#60;br /&#62;
　　例:&#60;br /&#62;
　　&#38;lt;?&#60;br /&#62;
　　echo urlencode(&#34;七七IT中国&#34;);&#60;br /&#62;
　　?&#38;gt;&#60;br /&#62;
　　JSP中的用法:&#60;br /&#62;
　　URLEncoder.encode(&#34;七七IT中国&#34;);&#60;br /&#62;
　　&#38;lt;%&#60;br /&#62;
　　java.net.URLEncoder.encode(&#34;七七IT中国&#34;);&#60;br /&#62;
　　%&#38;gt;
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "从jar包中读取配置文件信息"</title>
<link>http://www.ll19.com/bb/topic/97#post-97</link>
<pubDate>Sun, 03 Jan 2010 15:59:45 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">97@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;kk.jar的目录结构如下&#60;/p&#62;
&#60;p&#62;+kk.jar&#60;br /&#62;
    +META-INF&#60;br /&#62;
        MANIFEST.MF&#60;br /&#62;
    +config&#60;br /&#62;
        database.properties&#60;/p&#62;
&#60;p&#62;目标：读取database.properties中的参数信息&#60;/p&#62;
&#60;p&#62;types=mysql&#60;br /&#62;
mysql.url=jdbc:mysql://127.0.0.1:3306/tjtz&#60;br /&#62;
mysql.user=root&#60;br /&#62;
mysql.password=root&#60;br /&#62;
mysql.driver=com.mysql.jdbc.Driver&#60;br /&#62;
mysql.maxCounts=5&#60;/p&#62;
&#60;p&#62;代码如下：&#60;/p&#62;
&#60;p&#62;/*&#60;br /&#62;
* @(#)JarFileReader.java Oct 9, 2008&#60;br /&#62;
*&#60;br /&#62;
* Copyright (c) 2008 by jadmin. All Rights Reserved.&#60;br /&#62;
*/&#60;/p&#62;
&#60;p&#62;package file.jar;&#60;/p&#62;
&#60;p&#62;import java.io.IOException;&#60;br /&#62;
import java.io.InputStream;&#60;br /&#62;
import java.util.Properties;&#60;br /&#62;
import java.util.Set;&#60;br /&#62;
import java.util.jar.JarEntry;&#60;br /&#62;
import java.util.jar.JarFile;&#60;/p&#62;
&#60;p&#62;/**&#60;br /&#62;
* 从jar包中读取配置文件信息&#60;br /&#62;
*&#60;br /&#62;
* @author &#60;a href=&#34;mailto:jadmin@yeah.net&#34;&#62;jadmin&#60;/a&#62;&#60;br /&#62;
* @version 1.00 Oct 9, 2008 1:10:44 AM&#60;br /&#62;
*/&#60;br /&#62;
public class JarReader {&#60;/p&#62;
&#60;p&#62;public static void main(String[] args) {&#60;br /&#62;
   String jarPath = &#34;C:\\Documents and Settings\\Administrator\\桌面\\新建文件夹\\kk.jar&#34;;&#60;br /&#62;
   String entryFile = &#34;config/database.properties&#34;;&#60;br /&#62;
   doRead(jarPath,entryFile);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;public static void doRead(String jarPath, String entryFile) {&#60;br /&#62;
   try {&#60;br /&#62;
    JarFile jarFile = new JarFile(jarPath);&#60;br /&#62;
    JarEntry entry = jarFile.getJarEntry(entryFile);&#60;br /&#62;
    InputStream input = jarFile.getInputStream(entry);&#60;br /&#62;
    process(input);&#60;br /&#62;
    jarFile.close();&#60;br /&#62;
   } catch (IOException e) {&#60;br /&#62;
    e.printStackTrace();&#60;br /&#62;
   }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;private static void process(InputStream input) {&#60;br /&#62;
   Properties p = new Properties();&#60;br /&#62;
   try {&#60;br /&#62;
    p.load(input);&#60;br /&#62;
    Set&#38;lt;?&#38;gt; set = p.keySet();&#60;br /&#62;
    for (Object name : set)&#60;br /&#62;
     System.out.println(name + &#34;=&#34; + p.getProperty((String) name));&#60;br /&#62;
   } catch (IOException e) {&#60;br /&#62;
    e.printStackTrace();&#60;br /&#62;
   }&#60;br /&#62;
}&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;方法2&#60;/p&#62;
&#60;p&#62;   1. String fileName = &#34;/config/abcd.config&#34;;&#60;br /&#62;
   2. InputStream in = getClass().getResourceAsStream(fileName);&#60;br /&#62;
   3. BufferedReader br = null;&#60;br /&#62;
   4. try{&#60;br /&#62;
   5.     br = new BufferedReader(new InputStreamReader(in));&#60;br /&#62;
   6.     String line;&#60;br /&#62;
   7.     while ((line = br.readLine()) != null){&#60;br /&#62;
   8.         System.out.println(line);&#60;br /&#62;
   9.     }&#60;br /&#62;
  10.     br.close();&#60;br /&#62;
  11. } catch (Exception e){&#60;br /&#62;
  12.     // TODO Auto-generated catch block&#60;br /&#62;
  13.     e.printStackTrace();&#60;br /&#62;
  14. } finally{&#60;br /&#62;
  15.     if (br != null){&#60;br /&#62;
  16.         try{&#60;br /&#62;
  17.             br.close();&#60;br /&#62;
  18.         } catch (IOException e){&#60;br /&#62;
  19.             // TODO Auto-generated catch block&#60;br /&#62;
  20.             e.printStackTrace();&#60;br /&#62;
  21.         }&#60;br /&#62;
  22.     }&#60;br /&#62;
  23. }
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "MAVEN2的配置"</title>
<link>http://www.ll19.com/bb/topic/96#post-96</link>
<pubDate>Sun, 03 Jan 2010 15:56:14 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">96@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;maven是一个java项目管理工具，深化了ant，但又有自己一整套的项目集成策略。目前的版本是2.0.2。&#60;/p&#62;
&#60;p&#62;   1.&#60;/p&#62;
&#60;p&#62;      maven网站 下载maven2，解压缩&#60;br /&#62;
   2.&#60;/p&#62;
&#60;p&#62;      配置环境变量:maven_home、path&#60;br /&#62;
   3.&#60;/p&#62;
&#60;p&#62;      cmd-&#38;gt; mvn --version 检查是否安装成功 [显示版本号，则说明安装成功]&#60;br /&#62;
   4.&#60;/p&#62;
&#60;p&#62;      配置,Maven的配置分为三个层次:&#60;br /&#62;
          *&#60;/p&#62;
&#60;p&#62;            - pom.xml:针对某个项目的配置&#60;br /&#62;
          *&#60;/p&#62;
&#60;p&#62;            Installation&#60;br /&#62;
          *&#60;/p&#62;
&#60;p&#62;            User -针对某个用户的配置&#60;/p&#62;
&#60;p&#62;      我们首先配置主要是user级别的，主要包括两点:设置本地的资源库和代理服务器[如果需要的话] 在%maven_home%/conf/setting.xml中配置:&#60;/p&#62;
&#60;p&#62;                          &#38;lt;localRepository&#38;gt;d:/repo&#38;lt;/localRepository&#38;gt;&#60;/p&#62;
&#60;p&#62;                          &#38;lt;proxy&#38;gt;&#60;br /&#62;
                              &#38;lt;id&#38;gt;proxy1&#38;lt;/id&#38;gt;&#60;br /&#62;
                              &#38;lt;active&#38;gt;true&#38;lt;/active&#38;gt;&#60;br /&#62;
                              &#38;lt;protocol&#38;gt;http&#38;lt;/protocol&#38;gt;&#60;br /&#62;
                              &#38;lt;username&#38;gt;&#38;lt;/username&#38;gt;&#60;br /&#62;
                              &#38;lt;password&#38;gt;&#38;lt;/password&#38;gt;&#60;br /&#62;
                              &#38;lt;host&#38;gt;222.136.91.1&#38;lt;/host&#38;gt;&#60;br /&#62;
                              &#38;lt;port&#38;gt;80&#38;lt;/port&#38;gt;&#60;br /&#62;
                              &#38;lt;nonProxyHosts&#38;gt;&#38;lt;/nonProxyHosts&#38;gt;&#60;br /&#62;
                          &#38;lt;/proxy&#38;gt;&#60;/p&#62;
&#60;p&#62;      修改之后copy一份到${home}/.m2&#60;br /&#62;
   5.&#60;/p&#62;
&#60;p&#62;      建立新的项目&#60;/p&#62;
&#60;p&#62;                          mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app&#60;/p&#62;
&#60;p&#62;          *&#60;/p&#62;
&#60;p&#62;            首先，程序会从远程下载必要的jar包到你的localRepository,即我们刚刚设置的[d:/repo]&#60;br /&#62;
          *&#60;/p&#62;
&#60;p&#62;            然后，会在当前目录下面生成my-app文件夹，包括简单的包结构[java,test]和一个HelloWorld程序及测试,以及pom.xml文件。&#60;/p&#62;
&#60;p&#62;      注意：pom.xml contains the Project Object Model (POM) for this project.The POM is the basic unit of work in Maven。&#60;br /&#62;
   6.&#60;/p&#62;
&#60;p&#62;      编译&#60;/p&#62;
&#60;p&#62;      mvn compile&#60;/p&#62;
&#60;p&#62;      第一次运行会下载很多jar包,而且机器负荷会很重。运行这个命令需要在pom.xml相同目录下面, 这个编译只编译主程序，不会编译test下面的程序。如果需要单独编译test,请运行：&#60;/p&#62;
&#60;p&#62;      mvn test-compile&#60;/p&#62;
&#60;p&#62;      compile之后会生成target文件夹，主程序编译在classes下面，测试程序放在test-classes下&#60;br /&#62;
   7.&#60;/p&#62;
&#60;p&#62;      测试&#60;/p&#62;
&#60;p&#62;      mvn test&#60;/p&#62;
&#60;p&#62;      会自动先编译再运行测试&#60;br /&#62;
   8.&#60;/p&#62;
&#60;p&#62;      打包&#60;/p&#62;
&#60;p&#62;      mvn package&#60;/p&#62;
&#60;p&#62;      打包之前会进行编译，测试&#60;br /&#62;
   9.&#60;/p&#62;
&#60;p&#62;      安装&#60;/p&#62;
&#60;p&#62;      mvn install&#60;/p&#62;
&#60;p&#62;      会将package之后的jar包copy到&#60;br /&#62;
      &#38;lt;local-repository&#38;gt;/com/mycompany/app/my-app/1.0-SNAPSHOT/my-app-1.0-SNAPSHOT.jar&#60;br /&#62;
  10.&#60;/p&#62;
&#60;p&#62;      其他&#60;/p&#62;
&#60;p&#62;      mvn site&#60;/p&#62;
&#60;p&#62;      注意,还可以:&#60;/p&#62;
&#60;p&#62;      deploy site&#60;/p&#62;
&#60;p&#62;      在pom.xml中加入&#60;/p&#62;
&#60;p&#62;       &#38;lt;distributionManagement&#38;gt;&#60;br /&#62;
          &#38;lt;site&#38;gt;&#60;br /&#62;
            &#38;lt;id&#38;gt; website &#38;lt;/id&#38;gt;&#60;br /&#62;
               &#38;lt; url&#38;gt; &#60;a href=&#34;scp://www.mycompany.com/www/docs/project/&#34; rel=&#34;nofollow&#34;&#62;scp://www.mycompany.com/www/docs/project/&#60;/a&#62; &#38;lt;/url&#38;gt;&#60;br /&#62;
          &#38;lt;/site&#38;gt;&#60;br /&#62;
        &#38;lt;/distributionManagement&#38;gt;&#60;/p&#62;
&#60;p&#62;      当然你需要设置server&#60;/p&#62;
&#60;p&#62;      mvn site-deploy&#60;br /&#62;
      mvn clean&#60;br /&#62;
      mvn idea:idea [为IDE工具idea生成项目文件]&#60;/p&#62;
&#60;p&#62;  11.&#60;/p&#62;
&#60;p&#62;      Resource&#60;/p&#62;
&#60;p&#62;      ${basedir}/src/main/resources都会编译到jar文件中,而且该目录下的内容将直接位于jar文件的顶部。&#60;/p&#62;
&#60;p&#62;      测试用资源文件-&#38;gt; ${basedir}/src/test/resources，引用时如下例：&#60;/p&#62;
&#60;p&#62;      InputStream is = getClass().getResourceAsStream( &#34;/test.properties&#34; );&#60;/p&#62;
&#60;p&#62;      文件位于 ${basedir}/src/test/resources/test.properties。&#60;br /&#62;
  12.&#60;/p&#62;
&#60;p&#62;      如何filter我们的资源文件&#60;/p&#62;
&#60;p&#62;         &#38;lt; build &#38;gt;&#60;br /&#62;
           &#38;lt; resources &#38;gt;&#60;br /&#62;
             &#38;lt; resource &#38;gt;&#60;br /&#62;
               &#38;lt; directory &#38;gt; src/main/resources &#38;lt;/ directory &#38;gt;&#60;br /&#62;
               &#38;lt; filtering &#38;gt; true &#38;lt;/ filtering &#38;gt;&#60;br /&#62;
             &#38;lt;/ resource &#38;gt;&#60;br /&#62;
           &#38;lt;/ resources &#38;gt;&#60;br /&#62;
         &#38;lt;/ build &#38;gt;&#60;/p&#62;
&#60;p&#62;      因为原来默认的filter为false所以要加上上面的代码&#60;/p&#62;
&#60;p&#62;      eg:我们在src/main/resources下面建立application.properties文件&#60;/p&#62;
&#60;p&#62;      # application.properties&#60;br /&#62;
       application.name=${pom.name}&#60;br /&#62;
       application.version=${pom.version}&#60;/p&#62;
&#60;p&#62;      运行：mvn process-resources 在target/classes下面的application.properties结果为：&#60;/p&#62;
&#60;p&#62;       # application.properties&#60;br /&#62;
       application.name=Maven Quick Start Archetype&#60;br /&#62;
       application.version=1.0-SNAPSHOT&#60;/p&#62;
&#60;p&#62;      这就是所谓的filter。当然filter还可以用其他的外部文件，不一定来自pom.xml[ ${pom.name} ]以及setting.xml[ ${settings.localRepository }]&#60;/p&#62;
&#60;p&#62;      e.g src/main/filters/filter.properties:&#60;/p&#62;
&#60;p&#62;      # filter.properties&#60;br /&#62;
       my.filter.value=hello!&#60;/p&#62;
&#60;p&#62;      pom.xml:&#60;/p&#62;
&#60;p&#62;       &#38;lt; build &#38;gt;&#60;br /&#62;
           &#38;lt; filters &#38;gt;&#60;br /&#62;
             &#38;lt; filter &#38;gt; src/main/filters/filter.properties &#38;lt;/ filter &#38;gt;&#60;br /&#62;
           &#38;lt;/ filters &#38;gt;&#60;br /&#62;
           &#38;lt; resources &#38;gt;&#60;br /&#62;
             &#38;lt; resource &#38;gt;&#60;br /&#62;
               &#38;lt; directory &#38;gt; src/main/resources &#38;lt;/ directory &#38;gt;&#60;br /&#62;
               &#38;lt; filtering &#38;gt; true &#38;lt;/ filtering &#38;gt;&#60;br /&#62;
             &#38;lt;/ resource &#38;gt;&#60;br /&#62;
           &#38;lt;/ resources &#38;gt;&#60;br /&#62;
         &#38;lt;/ build &#38;gt; &#60;/p&#62;
&#60;p&#62;      # application.properties&#60;/p&#62;
&#60;p&#62;      application.name=${pom.name}&#60;br /&#62;
      application.version=${pom.version}&#60;br /&#62;
      message=${my.filter.value}&#60;/p&#62;
&#60;p&#62;      这样在运行mvn process-resources 会得到类似的效果,当然我们也可以直接在pom.xml中定义：&#60;/p&#62;
&#60;p&#62;      &#38;lt; build &#38;gt;&#60;br /&#62;
           &#38;lt; resources &#38;gt;&#60;br /&#62;
             &#38;lt; resource &#38;gt;&#60;br /&#62;
               &#38;lt; directory &#38;gt; src/main/resources &#38;lt;/ directory &#38;gt;&#60;br /&#62;
               &#38;lt; filtering &#38;gt; true &#38;lt;/ filtering &#38;gt;&#60;br /&#62;
             &#38;lt;/ resource &#38;gt;&#60;br /&#62;
           &#38;lt;/ resources &#38;gt;&#60;br /&#62;
         &#38;lt;/ build &#38;gt;&#60;br /&#62;
         &#38;lt; properties &#38;gt;&#60;br /&#62;
           &#38;lt; my .filter.value &#38;gt; hello &#38;lt;/ my.filter.value &#38;gt;&#60;br /&#62;
         &#38;lt;/ properties &#38;gt; &#60;/p&#62;
&#60;p&#62;      效果同样，这样就不需要外部文件了。另外filter还可以来自系统设置以及可以自定义：&#60;/p&#62;
&#60;p&#62;      # application.properties&#60;br /&#62;
      java.version=${java.version}&#60;br /&#62;
      command.line.prop=${command.line.prop}&#60;/p&#62;
&#60;p&#62;  13.&#60;/p&#62;
&#60;p&#62;      jar包依赖&#60;/p&#62;
&#60;p&#62;      我们在mvn install后在local repo中生成的jar包也可以被其他项目所引用&#60;/p&#62;
&#60;p&#62;      &#38;lt;dependency&#38;gt;&#60;br /&#62;
            &#38;lt;groupId&#38;gt;com.mycompany.app&#38;lt;/groupId&#38;gt;&#60;br /&#62;
            &#38;lt;artifactId&#38;gt;my-app&#38;lt;/artifactId&#38;gt;&#60;br /&#62;
            &#38;lt;version&#38;gt;1.0-SNAPSHOT&#38;lt;/version&#38;gt;&#60;br /&#62;
            &#38;lt;scope&#38;gt;compile&#38;lt;/scope&#38;gt;&#60;br /&#62;
      &#38;lt;/dependency&#38;gt;&#60;/p&#62;
&#60;p&#62;      注意scope,这里是compile,如果使用junit，scope是test。&#60;/p&#62;
&#60;p&#62;      举例说明：如果我们的project需要用到log4j包，那么我们可以 先google--&#34;site:www.ibiblio.org maven2 log4j&#34;。Index of /maven2/log4j/log4j 下面有maven-metadata.xml 描述了groupId,artifactId,version等等。获取了这些信息之后，你 就可以在pom.xml中添加依赖&#60;/p&#62;
&#60;p&#62;      &#38;lt;dependency&#38;gt;&#60;br /&#62;
            &#38;lt;groupId&#38;gt;log4j&#38;lt;/groupId&#38;gt;&#60;br /&#62;
            &#38;lt;artifactId&#38;gt;log4j&#38;lt;/artifactId&#38;gt;&#60;br /&#62;
            &#38;lt;version&#38;gt;1.2.12&#38;lt;/version&#38;gt;&#60;br /&#62;
            &#38;lt;scope&#38;gt;compile&#38;lt;/scope&#38;gt;&#60;br /&#62;
      &#38;lt;/dependency&#38;gt;&#60;/p&#62;
&#60;p&#62;  14.&#60;/p&#62;
&#60;p&#62;      如何发布我的jar包到我的remote repository&#60;/p&#62;
&#60;p&#62;      你需要在setting.xml中间设置server:&#60;/p&#62;
&#60;p&#62;      &#38;lt;servers&#38;gt;&#60;br /&#62;
          &#38;lt;server&#38;gt;&#60;br /&#62;
            &#38;lt;id&#38;gt;mycompany-repository&#38;lt;/id&#38;gt;&#60;br /&#62;
            &#38;lt;username&#38;gt;jvanzyl&#38;lt;/username&#38;gt;&#60;br /&#62;
            &#38;lt;!-- Default value is ~/.ssh/id_dsa --&#38;gt;&#60;br /&#62;
           &#38;lt;privateKey&#38;gt;/path/to/identity&#38;lt;/privateKey&#38;gt;&#60;br /&#62;
               &#38;lt;passphrase&#38;gt;my_key_passphrase&#38;lt;/passphrase&#38;gt;&#60;br /&#62;
          &#38;lt;/server&#38;gt;&#60;br /&#62;
      &#38;lt;/servers&#38;gt;&#60;/p&#62;
&#60;p&#62;      然后在pom.xml中设置远程url:&#60;/p&#62;
&#60;p&#62;      &#38;lt;distributionManagement&#38;gt;&#60;br /&#62;
          &#38;lt;repository&#38;gt;&#60;br /&#62;
            &#38;lt;id&#38;gt;mycompany-repository&#38;lt;/id&#38;gt;&#60;br /&#62;
            &#38;lt;name&#38;gt;MyCompany Repository&#38;lt;/name&#38;gt;&#60;br /&#62;
           &#38;lt;url&#38;gt;scp://repository.mycompany.com/repository/maven2&#38;lt;/url&#38;gt;&#60;br /&#62;
          &#38;lt;/repository&#38;gt;&#60;br /&#62;
        &#38;lt;/distributionManagement&#38;gt;&#60;/p&#62;
&#60;p&#62;1.2. Maven2的Eclipse插件安装和使用&#60;br /&#62;
1.2.1. 安装&#60;/p&#62;
&#60;p&#62;你可以从http://m2eclipse.codehaus.orgupdate安装Maven2的Eclipse插件，具体 安装步骤请看该网站提供的Flash Demo: &#60;a href=&#34;http://m2eclipse.codehaus.org/Installing_Maven_2.0_plugin_for_Eclipse.html&#34; rel=&#34;nofollow&#34;&#62;http://m2eclipse.codehaus.org/Installing_Maven_2.0_plugin_for_Eclipse.html&#60;/a&#62;&#60;br /&#62;
1.2.2. 使用&#60;/p&#62;
&#60;p&#62;该插件的使用请看该网站提供的Flash Demo: &#60;a href=&#34;http://m2eclipse.codehaus.org/Maven_2.0_Plugin_for_Eclipse.html&#34; rel=&#34;nofollow&#34;&#62;http://m2eclipse.codehaus.org/Maven_2.0_Plugin_for_Eclipse.html&#60;/a&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "ORACLE行转列"</title>
<link>http://www.ll19.com/bb/topic/95#post-95</link>
<pubDate>Sun, 03 Jan 2010 15:54:32 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">95@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;物料 需要数量 需要仓库 现存量仓库 现存量仓库数量 批次&#60;br /&#62;
A1 2 C1 C1         20         123&#60;br /&#62;
A1 2 C1 C2         30         111&#60;br /&#62;
A1 2 C1 C2         20         222&#60;br /&#62;
A1 2 C1 C3         10         211&#60;br /&#62;
A2 3 C4 C1         40         321&#60;br /&#62;
A2 3 C4 C4         50         222&#60;br /&#62;
A2 3 C4 C4         60         333&#60;br /&#62;
A2 3 C4 C5         70         223&#60;br /&#62;
我需要把上面的查询结果转换为下面的。&#60;br /&#62;
物料 需要数量 需要仓库 C1 C2 C3 C4 C5&#60;br /&#62;
A1 2 C1 20 50 10 0 0&#60;br /&#62;
A2 3 C4 40 0 0 110 70&#60;br /&#62;
*/&#60;br /&#62;
---------------------------------------------------------------建表&#60;br /&#62;
----------------判断表是否存在&#60;br /&#62;
declare num number;&#60;br /&#62;
begin&#60;br /&#62;
    select count(1) into num from user_tables where table_name='TEST';&#60;br /&#62;
    if num&#38;gt;0 then&#60;br /&#62;
      execute immediate 'drop table TEST';&#60;br /&#62;
    end if;&#60;br /&#62;
end;&#60;br /&#62;
----------------建表&#60;br /&#62;
CREATE TABLE TEST(&#60;br /&#62;
    WL VARCHAR2(10),&#60;br /&#62;
    XYSL INTEGER,&#60;br /&#62;
    XYCK VARCHAR2(10),&#60;br /&#62;
    XCLCK VARCHAR2(10),&#60;br /&#62;
    XCLCKSL INTEGER,&#60;br /&#62;
    PC INTEGER&#60;br /&#62;
);&#60;br /&#62;
----------------第一部分测试数据&#60;br /&#62;
INSERT INTO TEST VALUES('A1', 2, 'C1', 'C1' ,        20,         123);&#60;br /&#62;
INSERT INTO TEST VALUES('A1', 2, 'C1', 'C2' ,        30,         111);&#60;br /&#62;
INSERT INTO TEST VALUES('A1', 2, 'C1', 'C2' ,        20,         222);&#60;br /&#62;
INSERT INTO TEST VALUES('A1', 2, 'C1', 'C3' ,        10,         211);&#60;br /&#62;
INSERT INTO TEST VALUES('A2', 3, 'C4', 'C1' ,        40,         321);&#60;br /&#62;
INSERT INTO TEST VALUES('A2', 3, 'C4', 'C4' ,        50,         222);&#60;br /&#62;
INSERT INTO TEST VALUES('A2', 3, 'C4', 'C4' ,        60,         333);&#60;br /&#62;
INSERT INTO TEST VALUES('A2', 3, 'C4', 'C5' ,        70,         223);&#60;br /&#62;
COMMIT;&#60;br /&#62;
--select * from test;&#60;br /&#62;
---------------------------------------------------------------行转列的存储过程&#60;br /&#62;
CREATE OR REPLACE PROCEDURE P_TEST IS&#60;br /&#62;
  V_SQL VARCHAR2(2000);&#60;br /&#62;
  CURSOR CURSOR_1 IS SELECT DISTINCT T.XCLCK FROM TEST T ORDER BY XCLCK;&#60;/p&#62;
&#60;p&#62;    BEGIN&#60;br /&#62;
      V_SQL := 'SELECT WL,XYSL,XYCK';&#60;/p&#62;
&#60;p&#62;      FOR V_XCLCK IN CURSOR_1&#60;br /&#62;
      LOOP&#60;br /&#62;
        V_SQL := V_SQL &#124;&#124; ',' &#124;&#124; 'SUM(DECODE(XCLCK,''' &#124;&#124; V_XCLCK.XCLCK &#124;&#124;&#60;br /&#62;
                 ''',XCLCKSL,0)) AS ' &#124;&#124; V_XCLCK.XCLCK;&#60;br /&#62;
      END LOOP;&#60;/p&#62;
&#60;p&#62;      V_SQL := V_SQL &#124;&#124; ' FROM TEST GROUP BY WL,XYSL,XYCK ORDER BY WL,XYSL,XYCK';&#60;br /&#62;
      --DBMS_OUTPUT.PUT_LINE(V_SQL);&#60;br /&#62;
      V_SQL := 'CREATE OR REPLACE VIEW RESULT  AS '&#124;&#124;  V_SQL;&#60;br /&#62;
      --DBMS_OUTPUT.PUT_LINE(V_SQL);&#60;br /&#62;
      EXECUTE IMMEDIATE V_SQL;&#60;br /&#62;
    END;&#60;br /&#62;
----------------------------------------------------------------结果&#60;br /&#62;
----------------执行存储过程，生成视图&#60;br /&#62;
BEGIN&#60;br /&#62;
  P_TEST;&#60;br /&#62;
END;&#60;br /&#62;
----------------结果&#60;br /&#62;
SELECT * FROM RESULT T;&#60;br /&#62;
WL                                            XYSL XYCK               C1         C2         C3         C4         C5&#60;br /&#62;
---------- --------------------------------------- ---------- ---------- ---------- ---------- ---------- ----------&#60;br /&#62;
A1                                               2 C1                 20         50         10          0          0&#60;br /&#62;
A2                                               3 C4                 40          0          0        110         70&#60;/p&#62;
&#60;p&#62;----------------第二部分测试数据&#60;br /&#62;
INSERT INTO TEST VALUES('A1', 2, 'C1', 'C6' ,        20,         124);&#60;br /&#62;
INSERT INTO TEST VALUES('A2', 2, 'C1', 'C7' ,        30,         121);&#60;br /&#62;
INSERT INTO TEST VALUES('A3', 2, 'C1', 'C8' ,        20,         322);&#60;br /&#62;
COMMIT;&#60;br /&#62;
----------------报告存储过程，生成视图&#60;br /&#62;
BEGIN&#60;br /&#62;
  P_TEST;&#60;br /&#62;
END;&#60;br /&#62;
----------------结果&#60;br /&#62;
SELECT * FROM RESULT T;&#60;br /&#62;
WL     XYSL XYCK          C1       C2         C3         C4         C5         C6         C7         C8&#60;br /&#62;
----- ----- -------- ------- -------- ---------- ---------- ---------- ---------- ---------- ----------&#60;br /&#62;
A1        2 C1            20       50         10          0          0         20          0          0&#60;br /&#62;
A2        2 C1             0        0          0          0          0          0         30          0&#60;br /&#62;
A2        3 C4            40        0          0        110         70          0          0          0&#60;br /&#62;
A3        2 C1             0        0          0          0          0          0          0         20&#60;br /&#62;
--------------- 删除实体&#60;br /&#62;
DROP VIEW RESULT;&#60;br /&#62;
DROP PROCEDURE P_TEST;&#60;br /&#62;
DROP TABLE TEST;
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "ORACLE多行合并"</title>
<link>http://www.ll19.com/bb/topic/94#post-94</link>
<pubDate>Sun, 03 Jan 2010 15:53:17 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">94@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;例如有如下数据：m_researcher_stock_rel表&#60;/p&#62;
&#60;p&#62;N_SEC_CODE  				C_RESEARCHER_CODE&#60;/p&#62;
&#60;p&#62;000297                                   chenpeng           &#60;/p&#62;
&#60;p&#62;000297                                   liusu            &#60;/p&#62;
&#60;p&#62;合并处理后需显示为：&#60;/p&#62;
&#60;p&#62;000297                                   chenpeng,liusu&#60;/p&#62;
&#60;p&#62;wmsys.wm_concat 的用法&#60;/p&#62;
&#60;p&#62;select N_SEC_CODE, wmsys.wm_concat(C_RESEARCHER_CODE) p from m_researcher_stock_rel  GROUP BY N_SEC_CODE
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "存储过程返回结果集"</title>
<link>http://www.ll19.com/bb/topic/93#post-93</link>
<pubDate>Sun, 03 Jan 2010 15:50:08 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">93@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;首先要明确一个概念&#60;br /&#62;
PROCEDURE  TRIGGER PACKAGE 的区别&#60;br /&#62;
简单的说，PROCEDURE, TRIGGER都是一段程序&#60;br /&#62;
但PROCEDURE需要手工调用，TRIGGER满足你设定的条件会自动执行&#60;br /&#62;
PACKAGE是 把几个程序封装在一起，和JAVA里的PACKAGE的概念差不多。&#60;/p&#62;
&#60;p&#62;得到返回的结果集需要建立PACKAGE，并且返回列表需要通过返回游标实现&#60;/p&#62;
&#60;p&#62;由于oracle存储过程没有返回值，它的所有返回值都是通过out参数来替代的，列表同样也不例外，但由于是集合，所以不能用一般的参数，必须要用pagkage了.所以要分两部分。&#60;/p&#62;
&#60;p&#62;1、在SQL*PLUS中建一个程序包（在包中定义了一个类型游标）&#60;/p&#62;
&#60;p&#62;CREATE OR REPLACE PACKAGE TESTPACKAGE AS&#60;br /&#62;
TYPE Test_CURSOR IS REF CURSOR;&#60;br /&#62;
procedure TESTC(cur_ref out Test_CURSOR);&#60;br /&#62;
end TESTPACKAGE;&#60;/p&#62;
&#60;p&#62;2、建立包之后建立存储过程 &#60;/p&#62;
&#60;p&#62;create or replace package body TESTPACKAGE as&#60;br /&#62;
procedure TESTC(cur_ref out Test_CURSOR) is&#60;br /&#62;
begin&#60;br /&#62;
OPEN cur_ref FOR select * from test;&#60;br /&#62;
end TESTC;&#60;br /&#62;
END TESTPACKAGE;&#60;/p&#62;
&#60;p&#62;可以看到，它是把游标(cursor)（可以理解为一个指针），作为一个out 参数来返回值的。&#60;/p&#62;
&#60;p&#62;JAVA调用程序如下：&#60;/p&#62;
&#60;p&#62;<div class="igBar"><span id="ljava-17"><a href="#" onclick="javascript:showPlainTxt('java-17'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-17">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">package com.<span style="color: #006600;">rizon</span>.<span style="color: #006600;">tree</span>.<span style="color: #006600;">excelApi</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #a1a100;">import java.sql.Connection;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.sql.DriverManager;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.sql.ResultSet;&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #a1a100;">import java.sql.SQLException;&amp;#60;/p&amp;#62;</span></div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;public <span style="color: #000000; font-weight: bold;">class</span> CursorTest <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">static</span> <span style="color: #993333;">void</span> main<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> args<span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?q=allinurl%3AClassNotFoundException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">ClassNotFoundException</span></a>,&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASQLException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">SQLException</span></a> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AConnection+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Connection</span></a> conn = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3AResultSet+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">ResultSet</span></a> rs = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;<span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006600;">forName</span><span style="color: #66cc66;">&#40;</span>&amp;#34;oracle.<span style="color: #006600;">jdbc</span>.<span style="color: #006600;">driver</span>.<span style="color: #006600;">OracleDriver</span>&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn = <a href="http://www.google.com/search?q=allinurl%3ADriverManager+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">DriverManager</span></a>.<span style="color: #006600;">getConnection</span><span style="color: #66cc66;">&#40;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;#34;jdbc:oracle:thin:@<span style="color: #cc66cc;color:#800000;">10</span>.<span style="color: #cc66cc;color:#800000;">0</span>.<span style="color: #cc66cc;color:#800000;">41</span>.<span style="color: #cc66cc;color:#800000;">100</span>:<span style="color: #cc66cc;color:#800000;">1521</span>:orcl&amp;#34;, &amp;#34;forestrytree&amp;#34;,&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;#34;forestrytree&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;oracle.<span style="color: #006600;">jdbc</span>.<span style="color: #006600;">OracleCallableStatement</span> stmt = <span style="color: #66cc66;">&#40;</span>oracle.<span style="color: #006600;">jdbc</span>.<span style="color: #006600;">OracleCallableStatement</span><span style="color: #66cc66;">&#41;</span> conn&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006600;">prepareCall</span><span style="color: #66cc66;">&#40;</span>&amp;#34;<span style="color: #66cc66;">&#123;</span>call TESTPACKAGE.<span style="color: #006600;">TESTC</span><span style="color: #66cc66;">&#40;</span>?<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#125;</span>&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// stmt.setString(1, &amp;#34;1&amp;#34;);&amp;#60;br /&amp;#62;</span></div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stmt.<span style="color: #006600;">registerOutParameter</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>, oracle.<span style="color: #006600;">jdbc</span>.<span style="color: #006600;">OracleTypes</span>.<span style="color: #006600;">CURSOR</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stmt.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rs = stmt.<span style="color: #006600;">getCursor</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333;">int</span> i = <span style="color: #cc66cc;color:#800000;">0</span>; rs.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?q=allinurl%3ASystem+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">System</span></a>.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>&amp;#34; ----<span style="color: #66cc66;">&#91;</span>&amp;#34; + i + &amp;#34;<span style="color: #66cc66;">&#93;</span>name:&amp;#34; + rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + &amp;#34;telephone:&amp;#34; + rs.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> ex<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ex.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">finally</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>conn != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; conn = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;&nbsp;&nbsp;<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>rs != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rs.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rs = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;br /&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;&nbsp;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "有输入参数和输出参数的存储过程JAVA调用例子"</title>
<link>http://www.ll19.com/bb/topic/92#post-92</link>
<pubDate>Sun, 03 Jan 2010 15:48:08 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">92@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;<div class="igBar"><span id="ljava-18"><a href="#" onclick="javascript:showPlainTxt('java-18'); return false;">PLAIN TEXT</a></span></div><div class="syntax_hilite"><span class="langName">JAVA:</span><br /><div id="java-18">
<div class="java"><ol><li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;br /&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestProcedureTWO <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;public TestProcedureTWO<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;public <span style="color: #993333;">static</span> <span style="color: #993333;">void</span> main<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">String</span></a> args <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;String driver = &amp;#34;oracle.<span style="color: #006600;">jdbc</span>.<span style="color: #006600;">driver</span>.<span style="color: #006600;">OracleDriver</span>&amp;#34;;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;String strUrl = &amp;#34;jdbc:oracle:thin:@<span style="color: #cc66cc;color:#800000;">192</span>.<span style="color: #cc66cc;color:#800000;">168</span>.<span style="color: #cc66cc;color:#800000;">10</span>.<span style="color: #cc66cc;color:#800000;">216</span>:<span style="color: #cc66cc;color:#800000;">1521</span>:ctbu&amp;#34;;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;Statement stmt = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;ResultSet rs = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;Connection conn = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;try <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;Class.<span style="color: #006600;">forName</span><span style="color: #66cc66;">&#40;</span>driver<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;conn = <a href="http://www.google.com/search?q=allinurl%3ADriverManager+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">DriverManager</span></a>.<span style="color: #006600;">getConnection</span><span style="color: #66cc66;">&#40;</span>strUrl, &amp;#34;dbname&amp;#34;, &amp;#34;password&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;CallableStatement proc = <span style="color: #000000; font-weight: bold;">null</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;proc = conn.<span style="color: #006600;">prepareCall</span><span style="color: #66cc66;">&#40;</span>&amp;#34;<span style="color: #66cc66;">&#123;</span> call TESTB<span style="color: #66cc66;">&#40;</span>?,?<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span>&amp;#34;<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;proc.<span style="color: #006600;">setString</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">1</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;proc.<span style="color: #006600;">registerOutParameter</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span>, <a href="http://www.google.com/search?q=allinurl%3ATypes+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Types</span></a>.<span style="color: #006600;">VARCHAR</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;proc.<span style="color: #006600;">execute</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;String testPrint = proc.<span style="color: #006600;">getString</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;System.<span style="color: #006600;">out</span>.<span style="color: #006600;">println</span><span style="color: #66cc66;">&#40;</span>&amp;#34;=testPrint=is=&amp;#34;+testPrint<span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;catch <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ASQLException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">SQLException</span></a> ex2<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;ex2.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;catch <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">Exception</span></a> ex2<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;ex2.<span style="color: #006600;">printStackTrace</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;finally<span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;try <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;if<span style="color: #66cc66;">&#40;</span>rs != <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;rs.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;if<span style="color: #66cc66;">&#40;</span>stmt!=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;stmt.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;if<span style="color: #66cc66;">&#40;</span>conn!=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;conn.<span style="color: #006600;">close</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;catch <span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3ASQLException+java.sun.com&amp;bntl=1"><span style="color: #aaaadd; font-weight: bold;">SQLException</span></a> ex1<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-weight: bold;color:#26536A;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;/p&amp;#62;</div></li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;"><div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&amp;#60;p&amp;#62;<span style="color: #66cc66;">&#125;</span>&amp;#60;br /&amp;#62; </div></li></ol></div>
</div></div><br />
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "存储过程记录（只有输入参数）"</title>
<link>http://www.ll19.com/bb/topic/91#post-91</link>
<pubDate>Sun, 03 Jan 2010 15:46:05 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">91@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;过程&#60;/p&#62;
&#60;p&#62;过程是为了执行一定任务而组合在一起的SQL语句和PLSQL语句。（个人理解过程就是ORACLE的程序（或者说是方法、函数））&#60;/p&#62;
&#60;p&#62;只有输入参数时候的例子&#60;/p&#62;
&#60;p&#62;创建存储过程&#60;/p&#62;
&#60;p&#62;创建或替换一个存储过程myproc &#60;/p&#62;
&#60;p&#62;参数为id  ORACLE中参数默认为输入参数 in （之后用is 或者 as 都可以）&#60;/p&#62;
&#60;p&#62;CREATE  or replace procedure myproc(id in varchar2)&#60;br /&#62;
Is&#60;br /&#62;
定义一个变量 注意：定义变量一定要给出长度，参数可以不给出长度&#60;br /&#62;
Name varchar2(10);&#60;br /&#62;
Begin&#60;br /&#62;
将books_name放置到变量里面&#60;br /&#62;
Select books_name into Name form books where books_id = id;&#60;br /&#62;
Dbms_Output.put_line(Name);&#60;br /&#62;
End myproc;&#60;/p&#62;
&#60;p&#62;执行存储过程&#60;/p&#62;
&#60;p&#62;Declare&#60;br /&#62;
定义变量&#60;br /&#62;
Tid vachar2(10);&#60;br /&#62;
Begin&#60;br /&#62;
赋值&#60;br /&#62;
Tid := ‘001’;&#60;br /&#62;
Myproc(Tid);&#60;br /&#62;
End;&#60;/p&#62;
&#60;p&#62;完整内容：&#60;/p&#62;
&#60;p&#62;CREATE  or replace procedure myproc(idcs in varchar2)&#60;br /&#62;
Is&#60;br /&#62;
Namebl varchar2(10);&#60;br /&#62;
Begin&#60;br /&#62;
select name into Namebl from test where id = idcs;&#60;br /&#62;
Dbms_Output.put_line(Namebl);&#60;br /&#62;
End myproc;&#60;/p&#62;
&#60;p&#62;Declare&#60;br /&#62;
Tid integer(10);&#60;br /&#62;
Begin&#60;br /&#62;
Tid := 1;&#60;br /&#62;
Myproc(Tid);&#60;br /&#62;
End;&#60;/p&#62;
&#60;p&#62;或者 &#60;/p&#62;
&#60;p&#62;Begin&#60;br /&#62;
Myproc(1);&#60;br /&#62;
End;&#60;/p&#62;
&#60;p&#62;JAVA程序&#60;/p&#62;
&#60;p&#62;import java.sql.*;&#60;/p&#62;
&#60;p&#62;import java.io.OutputStream;&#60;/p&#62;
&#60;p&#62;import java.io.Writer;&#60;/p&#62;
&#60;p&#62;import java.sql.PreparedStatement;&#60;/p&#62;
&#60;p&#62;import java.sql.ResultSet;&#60;/p&#62;
&#60;p&#62;import oracle.jdbc.driver.*;&#60;/p&#62;
&#60;p&#62;public class TestProcedureOne {&#60;/p&#62;
&#60;p&#62;public TestProcedureOne() {&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;public static void main(String args ){&#60;/p&#62;
&#60;p&#62;String driver = &#34;oracle.jdbc.driver.OracleDriver&#34;;&#60;/p&#62;
&#60;p&#62;String strUrl = &#34;jdbc:oracle:thin:@192.168.10.216:1521:ctbu&#34;;&#60;/p&#62;
&#60;p&#62;Statement stmt = null;&#60;/p&#62;
&#60;p&#62;ResultSet rs = null;&#60;/p&#62;
&#60;p&#62;Connection conn = null;&#60;/p&#62;
&#60;p&#62;CallableStatement cstmt = null;&#60;/p&#62;
&#60;p&#62;try {&#60;/p&#62;
&#60;p&#62;Class.forName(driver);&#60;/p&#62;
&#60;p&#62;conn = DriverManager.getConnection(strUrl, &#34;dbname&#34;, &#34;password&#34;);&#60;/p&#62;
&#60;p&#62;CallableStatement proc = null;&#60;/p&#62;
&#60;p&#62;proc = conn.prepareCall(&#34;{ call TESTA(?,?) }&#34;);&#60;/p&#62;
&#60;p&#62;proc.setString(1, 1);&#60;/p&#62;
&#60;p&#62;proc.setString(2, &#34;232323&#34;);&#60;/p&#62;
&#60;p&#62;proc.execute();&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;catch (SQLException ex2) {&#60;/p&#62;
&#60;p&#62;ex2.printStackTrace();&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;catch (Exception ex2) {&#60;/p&#62;
&#60;p&#62;ex2.printStackTrace();&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;finally{&#60;/p&#62;
&#60;p&#62;try {&#60;/p&#62;
&#60;p&#62;if(rs != null){&#60;/p&#62;
&#60;p&#62;rs.close();&#60;/p&#62;
&#60;p&#62;if(stmt!=null){&#60;/p&#62;
&#60;p&#62;stmt.close();&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;if(conn!=null){&#60;/p&#62;
&#60;p&#62;conn.close();&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;catch (SQLException ex1) {&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;}
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "游标的记录"</title>
<link>http://www.ll19.com/bb/topic/90#post-90</link>
<pubDate>Sun, 03 Jan 2010 15:42:39 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">90@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;游标的作用&#60;/p&#62;
&#60;p&#62;游标可以对数据进行逐条的控制 &#60;/p&#62;
&#60;p&#62;平常写SELECT语句的时候得到的是一个统一的结果集，无法对结果进行逐条的控制，游标便可以实现逐条的控制。&#60;/p&#62;
&#60;p&#62;游标通过操作结果集中的数据，逐行进行处理来达某种目的。&#60;/p&#62;
&#60;p&#62;游标的使用方法&#60;/p&#62;
&#60;p&#62;比如需要对BOOKS表的每条记录进行逐条处理，首先在内存中申请空间，例如需要处理的select语句是Select * form books；，则：&#60;/p&#62;
&#60;p&#62;Declare&#60;br /&#62;
CURSOR mycur is&#60;br /&#62;
Select * form books；&#60;/p&#62;
&#60;p&#62;需要对此结果进行逐行的处理，则将游标对应的数据取出放在一个变量里，事先需要准备好一个变量，由于是表的所有字段，则这么写：&#60;br /&#62;
Myrecord books%ROWTYPE;&#60;/p&#62;
&#60;p&#62;接着就是将结果集打开&#60;br /&#62;
Begin&#60;br /&#62;
Open mycur;&#60;/p&#62;
&#60;p&#62;打开之后则把数据放到事先声明的变量里面&#60;br /&#62;
FETCH mycur INTO Myrecord;&#60;/p&#62;
&#60;p&#62;之后循环判断取数据&#60;br /&#62;
WHILE  mycur%FOUND&#60;br /&#62;
表示当游标中有数据可取 %FOUND为游标的四个属性的一个 返回布尔值 &#60;/p&#62;
&#60;p&#62;之后循环取值将数据显示：&#60;/p&#62;
&#60;p&#62;WHILE  mycur%FOUND LOOP&#60;br /&#62;
Dbms_Output.put_line(Myrecord.id &#124;&#124; Myrecord.name);&#60;br /&#62;
FETCH mycur INTO Myrecord;&#60;br /&#62;
END LOOP;&#60;br /&#62;
Close mycur;&#60;br /&#62;
End;&#60;br /&#62;
/&#60;br /&#62;
其中id就是BOOKS表中的字段id  name同样&#60;/p&#62;
&#60;p&#62;当数据量很大，不建议使用游标，比较消耗资源。
&#60;/p&#62;</description>
</item>
<item>
<title>admin on "varchar2的参数(byte和char)"</title>
<link>http://www.ll19.com/bb/topic/89#post-89</link>
<pubDate>Sun, 03 Jan 2010 15:38:53 +0000</pubDate>
<dc:creator>admin</dc:creator>
<guid isPermaLink="false">89@http://www.ll19.com/bb/</guid>
<description>&#60;p&#62;由于一个汉字在我的GBK系统里占用2个字节，所以byte的只能插入2个汉字，而char的可以插入5个汉字。&#60;br /&#62;
所以byte 就是字节数，对于汉字，GBK占用2个字节，如果是UTF-8则占用3个字节。&#60;br /&#62;
为了充分利用4000个的上限，给自己减少麻烦，建议存储含有中文文字的字段时，采用char类型。&#60;/p&#62;
&#60;p&#62;下面是测试&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; create table test(name varchar(5 byte),namec varchar(5 char));&#60;br /&#62;
表已创建。&#60;/p&#62;
&#60;p&#62;-----------------------byte测试------------------------------------&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(name) values('12345');&#60;br /&#62;
已创建 1 行。&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(name) values('123456');&#60;br /&#62;
insert into test(name) values('123456')&#60;br /&#62;
第 1 行出现错误:&#60;br /&#62;
ORA-12899: 列 &#34;SCOTT&#34;.&#34;TEST&#34;.&#34;NAME&#34; 的值太大 (实际值: 6, 最大值: 5)&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(name) values('天津');&#60;br /&#62;
已创建 1 行。&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(name) values('天津市');&#60;br /&#62;
insert into test(name) values('天津市')&#60;br /&#62;
第 1 行出现错误:&#60;br /&#62;
ORA-12899: 列 &#34;SCOTT&#34;.&#34;TEST&#34;.&#34;NAME&#34; 的值太大 (实际值: 6, 最大值: 5)&#60;/p&#62;
&#60;p&#62;-----------------------char测试------------------------------------&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(namec) values('12345');&#60;br /&#62;
已创建 1 行。&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(namec) values('123456');&#60;br /&#62;
insert into test(namec) values('123456')&#60;br /&#62;
第 1 行出现错误:&#60;br /&#62;
ORA-12899: 列 &#34;SCOTT&#34;.&#34;TEST&#34;.&#34;NAMEC&#34; 的值太大 (实际值: 6, 最大值: 5)&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(namec) values('天津');&#60;br /&#62;
已创建 1 行。&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(namec) values('天津市');&#60;br /&#62;
已创建 1 行。&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(namec) values('天津市北京');&#60;br /&#62;
已创建 1 行。&#60;/p&#62;
&#60;p&#62;SQL&#38;gt; insert into test(namec) values('天津市北京市');&#60;br /&#62;
insert into test(namec) values('天津市北京市')&#60;br /&#62;
第 1 行出现错误:&#60;br /&#62;
ORA-12899: 列 &#34;SCOTT&#34;.&#34;TEST&#34;.&#34;NAMEC&#34; 的值太大 (实际值: 6, 最大值: 5)&#60;/p&#62;
&#60;p&#62;-------------------------结果------------------------------------&#60;br /&#62;
SQL&#38;gt; select * from test;&#60;br /&#62;
NAME  NAMEC&#60;br /&#62;
----- ----------&#60;br /&#62;
12345&#60;br /&#62;
天津&#60;br /&#62;
             12345&#60;br /&#62;
             天津&#60;br /&#62;
             天津市&#60;br /&#62;
             天津市北京&#60;br /&#62;
已选择6行。&#60;/p&#62;
&#60;p&#62;-------------------------分析------------------------------------&#60;br /&#62;
由于一个汉字在我的GBK系统里占用2个字节，所以byte的只能插入2个汉字，而char的可以插入5个汉字。&#60;br /&#62;
所以byte 就是字节数，对于汉字，GBK占用2个字节，如果是UTF-8则占用3个字节。&#60;br /&#62;
为了充分利用4000个的上限，给自己减少麻烦，建议存储含有中文文字的字段时，采用char类型。
&#60;/p&#62;</description>
</item>

</channel>
</rss>

