<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nffish&#039;s Blog &#187; Java</title>
	<atom:link href="http://nffish.com/archives/category/java/feed" rel="self" type="application/rss+xml" />
	<link>http://nffish.com</link>
	<description>好记性不如烂笔头</description>
	<lastBuildDate>Mon, 12 Mar 2012 01:40:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>招聘 搜索引擎开发 &amp; 网页设计</title>
		<link>http://nffish.com/archives/382</link>
		<comments>http://nffish.com/archives/382#comments</comments>
		<pubDate>Mon, 01 Feb 2010 03:16:21 +0000</pubDate>
		<dc:creator>Nffish</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[招聘]]></category>

		<guid isPermaLink="false">http://nffish.com/?p=382</guid>
		<description><![CDATA[搜索引擎开发工程师（1人） 工作地：台州 职位描述: 1.负责搜索引擎系统相关开发 2.负责搜索引擎的日常维护和优化 职位要求: 1.一年以上开发经验 2.熟练掌握java或c#，精通面向对象技术 3.熟悉Lucene , Heritrix等开源搜索引擎框架 4.具有较强的算法设计能力，熟悉数据结构 5.了解中文分词原理，最好熟悉业界各种开源中文分词组件 6.具有良好的学习能力及工作责任心，良好的沟通能力和团队合作精神 7.热爱软件开发,关心开源软件社区的最新动态 网页设计师（1人） 工作地：台州 职位描述: 1.负责网站页面设计 2.与后台工程师合作完成网站系统...]]></description>
			<content:encoded><![CDATA[<p><strong>搜索引擎开发工程师（1人）</strong></p>
<p>工作地：台州</p>
<p>职位描述:<br />
1.负责搜索引擎系统相关开发<br />
2.负责搜索引擎的日常维护和优化</p>
<p>职位要求:<br />
1.一年以上开发经验<br />
2.熟练掌握java或c#，精通面向对象技术<br />
3.熟悉Lucene , Heritrix等开源搜索引擎框架<br />
4.具有较强的算法设计能力，熟悉数据结构<br />
5.了解中文分词原理，最好熟悉业界各种开源中文分词组件<br />
6.具有良好的学习能力及工作责任心，良好的沟通能力和团队合作精神<br />
7.热爱软件开发,关心开源软件社区的最新动态</p>
<p><strong>网页设计师（1人）</strong></p>
<p>工作地：台州</p>
<p>职位描述:<br />
1.负责网站页面设计<br />
2.与后台工程师合作完成网站系统</p>
<p>职位要求:<br />
1.熟练掌握HTML/XHTML,CSS,Ajax等前端技术<br />
2.熟练DIV+CSS网站布局，熟悉Web标准<br />
3.熟悉Photoshop或其他绘图软件<br />
4.熟悉java,c#,php,python等一种后台语言<br />
5.具有良好的学习能力及工作责任心，良好的沟通能力和团队合作精神</p>
<p>以上职位，薪金面议。<br />
简历请发至：nffish@gmail.com 注明应聘职位<br />
欢迎转载</p>
]]></content:encoded>
			<wfw:commentRss>http://nffish.com/archives/382/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Server Java / Tomcat / Mysql 工作环境配置</title>
		<link>http://nffish.com/archives/352</link>
		<comments>http://nffish.com/archives/352#comments</comments>
		<pubDate>Thu, 14 Jan 2010 03:21:27 +0000</pubDate>
		<dc:creator>Nffish</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://nffish.com/?p=352</guid>
		<description><![CDATA[第一步 配置java运行环境 安装JRE sudo apt-get install sun-java6-jre 安装JDK sudo apt-get install sun-java6-jdk 提示：安装过程中需要你回答是否同意使用协议（终端中红蓝色的提示界面），此时按tab键至OK，再按回车即可正常安装。 设置当前默认的java解释器： sudo update-alternatives &#8211;config java 执行后会出现类似如下的画面: There...]]></description>
			<content:encoded><![CDATA[<p><strong>第一步 配置java运行环境</strong></p>
<p>安装JRE<br />
sudo apt-get install sun-java6-jre</p>
<p>安装JDK<br />
sudo apt-get install sun-java6-jdk<br />
提示：安装过程中需要你回答是否同意使用协议（终端中红蓝色的提示界面），此时按tab键至OK，再按回车即可正常安装。</p>
<p>设置当前默认的java解释器：<br />
sudo update-alternatives &#8211;config java<br />
执行后会出现类似如下的画面:<br />
There are 2 alternatives which provide `java&#8217;.</p>
<p>Selection Alternative<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
1 /usr/bin/gij-wrapper-4.1<br />
*+ 2 /usr/lib/jvm/java-6-sun/jre/bin/java</p>
<p>Press enter to keep the default[*], or type selection number:<br />
输入 有包含 “sun” 的行的前面的数字。如上面显示，则输入2，然后回车确定。</p>
<p>配置JAVA环境变量:<br />
sudo vi /etc/environment<br />
在其中添加如下两行：<br />
CLASSPATH=.:/usr/lib/jvm/java-6-sun/lib<br />
JAVA_HOME=/usr/lib/jvm/java-6-sun</p>
<p>sudo vi /etc/jvm<br />
将文件中的<br />
/usr/lib/jvm/java-6-sun<br />
这一行填入到配置块的顶部</p>
<p><strong>第二步 安装Mysql</strong></p>
<p>要安装 MySQL，可以在终端提示符后运行下列命令：<br />
sudo apt-get install mysql-server<br />
sudo apt-get install mysql-client</p>
<p>一旦安装完成，MySQL 服务器应该自动启动。您可以在终端提示符后运行以下命令来检查 MySQL 服务器是否正在运行：<br />
sudo netstat -tap | grep mysql<br />
当您运行该命令时，您可以看到类似下面的行：<br />
tcp 0 0 localhost.localdomain:mysql *:* LISTEN -<br />
如果服务器不能正常运行，您可以通过下列命令启动它：<br />
sudo /etc/init.d/mysql restart<br />
进入mysql<br />
$mysql -uroot -p 管理员密码</p>
<p>配置 MySQL 的管理员密码：<br />
sudo mysqladmin -u root password newpassword</p>
<p><strong>第三步 安装Tomcat</strong></p>
<p>sudo apt-get install tomcat6<br />
启动和停止Tomcat</p>
<p>要启动Tomcat，运行<br />
sudo /usr/share/tomcat6/bin/./startup.sh<br />
可以在浏览器中访问http://ip地址:8080 测试</p>
<p>要停止Tomcat，运行<br />
sudo /usr/share/tomcat6/bin/./shutdown.sh</p>
<p>配置Tomcat的端口</p>
<p>sudo vi /etc/tomcat6/server.xml<br />
在配置文件中查找<br />
<Connector port="8080" protocol="HTTP/1.1"<br />
               connectionTimeout="20000"<br />
               redirectPort="8443" /><br />
把port=”8080&#8243;，改成80。</p>
]]></content:encoded>
			<wfw:commentRss>http://nffish.com/archives/352/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用Spring的过滤器解决中文乱码问题</title>
		<link>http://nffish.com/archives/234</link>
		<comments>http://nffish.com/archives/234#comments</comments>
		<pubDate>Mon, 04 May 2009 13:28:59 +0000</pubDate>
		<dc:creator>Nffish</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[编码]]></category>

		<guid isPermaLink="false">http://nffish.com/?p=234</guid>
		<description><![CDATA[以前处理中文需要自己写Filter类，Spring已经有一个处理字符编码的类了，所以就不需要自己写了，直接用就行。 在web.xml中添加一个全局过滤器 类文件为：org.springframework.web.filter.CharacterEncodingFilter 初始参数名：encoding 参数值：utf-8 示例： &#60;!&#8211; 配置spring的过滤器 &#8211;&#62; &#60;filter&#62; &#60;filter-name&#62;spring filter&#60;/filter-name&#62; &#60;filter-class&#62; org.springframework.web.filter.CharacterEncodingFilter &#60;/filter-class&#62; &#60;init-param&#62; &#60;param-name&#62;encoding&#60;/param-name&#62; &#60;param-value&#62;utf-8&#60;/param-value&#62; &#60;/init-param&#62; &#60;/filter&#62;...]]></description>
			<content:encoded><![CDATA[<p>以前处理中文需要自己写Filter类，Spring已经有一个处理字符编码的类了，所以就不需要自己写了，直接用就行。</p>
<p>在web.xml中添加一个全局过滤器</p>
<p>类文件为：org.springframework.web.filter.CharacterEncodingFilter<br />
初始参数名：encoding<br />
参数值：utf-8</p>
<p>示例：</p>
<p>&lt;!&#8211; 配置spring的过滤器 &#8211;&gt;<br />
&lt;filter&gt;<br />
&lt;filter-name&gt;spring filter&lt;/filter-name&gt;<br />
&lt;filter-class&gt;<br />
org.springframework.web.filter.CharacterEncodingFilter<br />
&lt;/filter-class&gt;<br />
&lt;init-param&gt;<br />
&lt;param-name&gt;encoding&lt;/param-name&gt;<br />
&lt;param-value&gt;utf-8&lt;/param-value&gt;<br />
&lt;/init-param&gt;<br />
&lt;/filter&gt;<br />
&lt;filter-mapping&gt;<br />
&lt;filter-name&gt;spring filter&lt;/filter-name&gt;<br />
&lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br />
&lt;/filter-mapping&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://nffish.com/archives/234/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>把数字转换成36进制</title>
		<link>http://nffish.com/archives/215</link>
		<comments>http://nffish.com/archives/215#comments</comments>
		<pubDate>Sun, 08 Mar 2009 08:38:55 +0000</pubDate>
		<dc:creator>Nffish</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[36进制]]></category>
		<category><![CDATA[算法]]></category>
		<category><![CDATA[进制转化]]></category>

		<guid isPermaLink="false">http://nffish.com/?p=215</guid>
		<description><![CDATA[36进制包括0-9和a-z，只有整形的可以转换。 long i=1234567890L; System.out.println(Long.toString(i,36).toLowerCase()); 输出:kf12oi]]></description>
			<content:encoded><![CDATA[<p>36进制包括0-9和a-z，只有整形的可以转换。</p>
<p>long i=1234567890L;<br />
System.out.println(Long.toString(i,36).toLowerCase());</p>
<p>输出:kf12oi</p>
]]></content:encoded>
			<wfw:commentRss>http://nffish.com/archives/215/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Java毕业项目即将开始</title>
		<link>http://nffish.com/archives/188</link>
		<comments>http://nffish.com/archives/188#comments</comments>
		<pubDate>Fri, 12 Dec 2008 13:45:11 +0000</pubDate>
		<dc:creator>Nffish</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[毕业项目]]></category>

		<guid isPermaLink="false">http://nffish.com/?p=188</guid>
		<description><![CDATA[最近学了关于《团队组建与项目计划》、《需求管理与配置管理》，马上就要开始B模块Java毕业项目。有点兴奋，又有点紧张。最近一直处在低谷中，精神不太好，要尽快竞争状态了。 毕业项目有两个选择，分别是HR和CRM。个人觉得HR系统的需求比较容易理解，CRM不是很熟悉。前几天拿到了两个需求文档，粗略的看了一下。 项目以Team为单位开发，4个人组成一个Team，每个人担任一个角色。我担任项目经理角色，但每个人都是开发人员和测试人员。 还要熟悉几款项目相关的软件: Microsoft Project, Microsoft Visio , Microsoft Visual SourceSafe 不知道为什么，都选择微软的产品。有Mac上的相关替代软件，请推荐一下。]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter" style="width: 510px"><a href="http://pic.yupoo.com/nffish/267426a5e1f1/c66vjn8c.jpg"><img title="点击大图 1280×800" src="http://pic.yupoo.com/nffish/267426a5e1f1/medium.jpg" alt="" width="500" height="313" /></a><p class="wp-caption-text">1280×800</p></div>
<p>最近学了关于《团队组建与项目计划》、《需求管理与配置管理》，马上就要开始B模块Java毕业项目。有点兴奋，又有点紧张。最近一直处在低谷中，精神不太好，要尽快竞争状态了。</p>
<p>毕业项目有两个选择，分别是HR和CRM。个人觉得HR系统的需求比较容易理解，CRM不是很熟悉。前几天拿到了两个需求文档，粗略的看了一下。</p>
<p>项目以Team为单位开发，4个人组成一个Team，每个人担任一个角色。我担任项目经理角色，但每个人都是开发人员和测试人员。</p>
<p>还要熟悉几款项目相关的软件: Microsoft Project, Microsoft Visio , Microsoft Visual SourceSafe</p>
<p>不知道为什么，都选择微软的产品。有Mac上的相关替代软件，请推荐一下。</p>
]]></content:encoded>
			<wfw:commentRss>http://nffish.com/archives/188/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>自动生成Java实体类</title>
		<link>http://nffish.com/archives/157</link>
		<comments>http://nffish.com/archives/157#comments</comments>
		<pubDate>Thu, 30 Oct 2008 13:18:18 +0000</pubDate>
		<dc:creator>Nffish</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://nffish.com/?p=157</guid>
		<description><![CDATA[JDBC读取数据库元数据,生成JAVA实体类 package com.nffish.util; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSetMetaData; import java.sql.SQLException; import com.nffish.common.DBSession; public...]]></description>
			<content:encoded><![CDATA[<p>JDBC读取数据库元数据,生成JAVA实体类</p>
<p>package com.nffish.util;</p>
<p>import java.io.FileWriter;<br />
import java.io.IOException;<br />
import java.io.PrintWriter;<br />
import java.sql.Connection;<br />
import java.sql.PreparedStatement;<br />
import java.sql.ResultSetMetaData;<br />
import java.sql.SQLException;</p>
<p>import com.nffish.common.DBSession;</p>
<p>public class GenEntityTool {<br />
&nbsp;&nbsp;&nbsp; private String tablename = &quot;petDiary&quot;;</p>
<p>&nbsp;&nbsp;&nbsp; private String[] colnames; // 列名数组</p>
<p>&nbsp;&nbsp;&nbsp; private String[] colTypes; // 列名类型数组</p>
<p>&nbsp;&nbsp;&nbsp; private int[] colSizes; // 列名大小数组</p>
<p>&nbsp;&nbsp;&nbsp; private boolean f_util = false; // 是否需要导入包java.util.*</p>
<p>&nbsp;&nbsp;&nbsp; private boolean f_sql = false; // 是否需要导入包java.sql.*</p>
<p>&nbsp;&nbsp;&nbsp; public GenEntityTool() {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Connection conn = DBSession.getConnection(); // 得到数据库连接<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String strsql = &quot;select * from &quot; + tablename;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PreparedStatement pstmt = conn.prepareStatement(strsql);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ResultSetMetaData rsmd = pstmt.getMetaData();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; int size = rsmd.getColumnCount(); // 共有多少列<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; colnames = new String[size];<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; colTypes = new String[size];<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; colSizes = new int[size];<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; rsmd.getColumnCount(); i++) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; colnames[i] = rsmd.getColumnName(i + 1);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; colTypes[i] = rsmd.getColumnTypeName(i + 1);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (colTypes[i].equalsIgnoreCase(&quot;datetime&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; f_util = true;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (colTypes[i].equalsIgnoreCase(&quot;image&quot;)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; || colTypes[i].equalsIgnoreCase(&quot;text&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; f_sql = true;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; colSizes[i] = rsmd.getColumnDisplaySize(i + 1);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; String content = parse(colnames, colTypes, colSizes);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; FileWriter fw = new FileWriter(initcap(tablename) + &quot;.java&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; PrintWriter pw = new PrintWriter(fw);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pw.println(content);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pw.flush();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; pw.close();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (IOException e) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; e.printStackTrace();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } catch (SQLException e) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; e.printStackTrace();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } finally {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; DBSession.closeConnection(conn);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; /**<br />
&nbsp;&nbsp;&nbsp; &nbsp;* 解析处理(生成实体类主体代码)<br />
&nbsp;&nbsp;&nbsp; &nbsp;*/<br />
&nbsp;&nbsp;&nbsp; private String parse(String[] colNames, String[] colTypes, int[] colSizes) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; StringBuffer sb = new StringBuffer();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (f_util) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;import java.util.Date;\r\n&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (f_sql) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;import java.sql.*;\r\n\r\n\r\n&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;public class &quot; + initcap(tablename) + &quot; {\r\n&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; processAllAttrs(sb);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; processAllMethod(sb);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;}\r\n&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; System.out.println(sb.toString());<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return sb.toString();</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; /**<br />
&nbsp;&nbsp;&nbsp; &nbsp;* 生成所有的方法<br />
&nbsp;&nbsp;&nbsp; &nbsp;* <br />
&nbsp;&nbsp;&nbsp; &nbsp;* @param sb<br />
&nbsp;&nbsp;&nbsp; &nbsp;*/<br />
&nbsp;&nbsp;&nbsp; private void processAllMethod(StringBuffer sb) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; colnames.length; i++) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;\tpublic void set&quot; + initcap(colnames[i]) + &quot;(&quot;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; + sqlType2JavaType(colTypes[i]) + &quot; &quot; + colnames[i]<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; + &quot;){\r\n&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;\t\tthis.&quot; + colnames[i] + &quot;=&quot; + colnames[i] + &quot;;\r\n&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;\t}\r\n&quot;);</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;\tpublic &quot; + sqlType2JavaType(colTypes[i]) + &quot; get&quot;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; + initcap(colnames[i]) + &quot;(){\r\n&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;\t\treturn &quot; + colnames[i] + &quot;;\r\n&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;\t}\r\n&quot;);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; /**<br />
&nbsp;&nbsp;&nbsp; &nbsp;* 解析输出属性<br />
&nbsp;&nbsp;&nbsp; &nbsp;* <br />
&nbsp;&nbsp;&nbsp; &nbsp;* @return<br />
&nbsp;&nbsp;&nbsp; &nbsp;*/<br />
&nbsp;&nbsp;&nbsp; private void processAllAttrs(StringBuffer sb) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; colnames.length; i++) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sb.append(&quot;\tprivate &quot; + sqlType2JavaType(colTypes[i]) + &quot; &quot;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; + colnames[i] + &quot;;\r\n&quot;);</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; /**<br />
&nbsp;&nbsp;&nbsp; &nbsp;* 把输入字符串的首字母改成大写<br />
&nbsp;&nbsp;&nbsp; &nbsp;* <br />
&nbsp;&nbsp;&nbsp; &nbsp;* @param str<br />
&nbsp;&nbsp;&nbsp; &nbsp;* @return<br />
&nbsp;&nbsp;&nbsp; &nbsp;*/<br />
&nbsp;&nbsp;&nbsp; private String initcap(String str) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; char[] ch = str.toCharArray();<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (ch[0] &gt;= &#8216;a&#8217; &amp;&amp; ch[0] &lt;= &#8216;z&#8217;) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ch[0] = (char) (ch[0] &#8211; 32);<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return new String(ch);<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; private String sqlType2JavaType(String sqlType) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (sqlType.equalsIgnoreCase(&quot;bit&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;bool&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;tinyint&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;byte&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;smallint&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;short&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;int&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;int&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;bigint&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;long&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;float&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;float&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;decimal&quot;)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; || sqlType.equalsIgnoreCase(&quot;numeric&quot;)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; || sqlType.equalsIgnoreCase(&quot;real&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;double&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;money&quot;)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; || sqlType.equalsIgnoreCase(&quot;smallmoney&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;double&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;varchar&quot;)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; || sqlType.equalsIgnoreCase(&quot;char&quot;)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; || sqlType.equalsIgnoreCase(&quot;nvarchar&quot;)<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; || sqlType.equalsIgnoreCase(&quot;nchar&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;String&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;datetime&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;Date&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else if (sqlType.equalsIgnoreCase(&quot;image&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;Blob&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; } else if (sqlType.equalsIgnoreCase(&quot;text&quot;)) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return &quot;Clob&quot;;<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return null;<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; public static void main(String[] args) {<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; new GenEntityTool();<br />
&nbsp;&nbsp;&nbsp; }<br />
}<br />
&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://nffish.com/archives/157/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
