<?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>Ruby 语言 思想驱动生活</title>
	<atom:link href="http://liubin.nanshapo.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://liubin.nanshapo.com</link>
	<description>Ruby,Rails,编程是一种乐趣。</description>
	<lastBuildDate>Tue, 31 Aug 2010 08:31:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>几个开源的在线考试系统</title>
		<link>http://liubin.nanshapo.com/2010/08/31/some-open-source-online-testing-application/</link>
		<comments>http://liubin.nanshapo.com/2010/08/31/some-open-source-online-testing-application/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 08:30:32 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=310</guid>
		<description><![CDATA[都是在sf上找到的。 1.TCExam agpl的许可证，麻烦。PHP/mysql的 功能一般，只是个考试系统，多语言支持。 地址：http://sourceforge.net/projects/tcexam/ 2. eFront &#8211; Refreshing eLearning 看截图还不错，主页：http://sourceforge.net/projects/efrontlearning/ 另一个主页：http://www.efrontlearning.net/ 3. WEB-SET CAMPUS http://sourceforge.net/projects/web-set-campus/ 4. GARC &#8211; An eLearning System http://sourceforge.net/projects/garc/ 5. Testa OTMS http://sourceforge.net/projects/testa-otms/]]></description>
			<content:encoded><![CDATA[<p>都是在sf上找到的。<br />
<br />
1.<strong>TCExam</strong> agpl的许可证，麻烦。PHP/mysql的<br />
功能一般，只是个考试系统，多语言支持。<br />
<img src="http://sourceforge.net/dbimage.php?id=138264" alt="" /><br />
<br />
地址：<a href="http://sourceforge.net/projects/tcexam/">http://sourceforge.net/projects/tcexam/</a><br />
<br />
2. <strong>eFront &#8211; Refreshing eLearning</strong><br />
<br />
看截图还不错，主页：<a href="http://sourceforge.net/projects/efrontlearning/">http://sourceforge.net/projects/efrontlearning/</a><br />
<br />
另一个主页：<a href="http://www.efrontlearning.net/">http://www.efrontlearning.net/</a><br />
<br />
<img src="http://sourceforge.net/dbimage.php?id=143448" alt="" /><br />
<br />
3. <strong>WEB-SET CAMPUS</strong><br />
<a href="http://sourceforge.net/projects/web-set-campus/">http://sourceforge.net/projects/web-set-campus/</a><br />
<br />
<img src="http://sourceforge.net/dbimage.php?id=232697" alt="" /><br />
<br />
4. <strong>GARC</strong> &#8211; An eLearning System<br />
<br />
<a href="http://sourceforge.net/projects/garc/">http://sourceforge.net/projects/garc/</a><br />
<br />
<img src="http://sourceforge.net/dbimage.php?id=267312" alt="" /><br />
<br />
5. <strong>Testa OTMS </strong><br />
<br />
<a href="http://sourceforge.net/projects/testa-otms/">http://sourceforge.net/projects/testa-otms/</a><br />
</p>
<p><img src="http://sourceforge.net/dbimage.php?id=230248" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/08/31/some-open-source-online-testing-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>回龙观地区通讯地址</title>
		<link>http://liubin.nanshapo.com/2010/08/04/%e5%9b%9e%e9%be%99%e8%a7%82%e5%9c%b0%e5%8c%ba%e9%80%9a%e8%ae%af%e5%9c%b0%e5%9d%80/</link>
		<comments>http://liubin.nanshapo.com/2010/08/04/%e5%9b%9e%e9%be%99%e8%a7%82%e5%9c%b0%e5%8c%ba%e9%80%9a%e8%ae%af%e5%9c%b0%e5%9d%80/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 09:57:58 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=303</guid>
		<description><![CDATA[中文：北京市昌平区回龙观(文化居住区)AA苑（园）B区CC号楼DD单元EEE 邮政编码：102208 英文：Room DD-EEE,Bldg No.CC,Block B,AA, Huilongguan residential area,Changping District,Beijing 102208,PRC]]></description>
			<content:encoded><![CDATA[<p>中文：北京市昌平区回龙观(文化居住区)AA苑（园）B区CC号楼DD单元EEE 邮政编码：102208<br />
英文：Room DD-EEE,Bldg No.CC,Block B,AA, Huilongguan residential area,Changping District,Beijing 102208,PRC</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/08/04/%e5%9b%9e%e9%be%99%e8%a7%82%e5%9c%b0%e5%8c%ba%e9%80%9a%e8%ae%af%e5%9c%b0%e5%9d%80/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>spring里的ModelAttribute</title>
		<link>http://liubin.nanshapo.com/2010/07/08/modelattribute-under-spring/</link>
		<comments>http://liubin.nanshapo.com/2010/07/08/modelattribute-under-spring/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 07:42:32 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=306</guid>
		<description><![CDATA[在spring里，model和form的对应不需要写xml文件，只需要在页面里用form这个taglib就可以了： email 这里的commandName就是和Controller里相互映射的model的名字（实例名） path=email指定了对应对象的属性。 Controller里可以这样写： protected ModelAndView sendInvite(@ModelAttribute(&#8220;invite&#8221;) Invite invite, BindingResult result, SessionStatus status, ModelMap model) {} 其中，参数的第一个invite会自动从form里生成一个Invite的实例并设置值，Controller里直接使用这个对象就可以。 而加上@SessionAttributes的话，可以在form里一直显示上次输入的form内容，直到自己调用status.setComplete()为止，这个操作的意思就是一个form相关联的操作已经结束，从session里清空就可以了]]></description>
			<content:encoded><![CDATA[<p>在spring里，model和form的对应不需要写xml文件，只需要在页面里用form这个taglib就可以了：</p>
<form:form method="post" commandName="invite"  >
email<br />
<form:errors path="email" cssClass="error" />
</p>
<form:input path="email" />
<p>这里的commandName就是和Controller里相互映射的model的名字（实例名）<br />
path=email指定了对应对象的属性。</p>
<p>Controller里可以这样写：<br />
protected ModelAndView sendInvite(@ModelAttribute(&#8220;invite&#8221;) Invite invite,<br />
			BindingResult result, SessionStatus status, ModelMap model) {}</p>
<p>其中，参数的第一个invite会自动从form里生成一个Invite的实例并设置值，Controller里直接使用这个对象就可以。</p>
<p>而加上@SessionAttributes的话，可以在form里一直显示上次输入的form内容，直到自己调用status.setComplete()为止，这个操作的意思就是一个form相关联的操作已经结束，从session里清空就可以了</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/07/08/modelattribute-under-spring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>svn不能提交的错误</title>
		<link>http://liubin.nanshapo.com/2010/07/01/svn-cannot-commit-with-two-line-comments/</link>
		<comments>http://liubin.nanshapo.com/2010/07/01/svn-cannot-commit-with-two-line-comments/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 08:25:58 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=304</guid>
		<description><![CDATA[Eclipse里提交代码的时候，提示： org.tigris.subversion.javahl.ClientException: APR does not understand this error code svn: Commit failed (details follow): svn: Cannot accept non-LF line endings in &#8216;svn:log&#8217; property comment写了2行而已，查了下，网上有人说每行最后以空格结尾就行了，我试了下还是不行。 不要comment，提交成功。。。奇怪。]]></description>
			<content:encoded><![CDATA[<p>Eclipse里提交代码的时候，提示：<br />
org.tigris.subversion.javahl.ClientException: APR does not understand this error code<br />
svn: Commit failed (details follow):<br />
svn: Cannot accept non-LF line endings in &#8216;svn:log&#8217; property</p>
<p>comment写了2行而已，查了下，网上有人说每行最后以空格结尾就行了，我试了下还是不行。</p>
<p>不要comment，提交成功。。。奇怪。</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/07/01/svn-cannot-commit-with-two-line-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在spring中设置request的charset为utf-8</title>
		<link>http://liubin.nanshapo.com/2010/07/01/set-request-chartset-to-utf8-unser-spring/</link>
		<comments>http://liubin.nanshapo.com/2010/07/01/set-request-chartset-to-utf8-unser-spring/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 06:48:24 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[乱码]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[request]]></category>
		<category><![CDATA[sprint]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=301</guid>
		<description><![CDATA[在java里可以用：request.setCharacterEncoding(&#8220;UTF-8&#8243;); 在Spring的Controller类里个别设置太麻烦，可以用filter &#60;filter-name&#62;Spring character encoding filter&#60;/filter-name&#62; &#160; &#160; &#160; &#160; &#60;filter-class&#62;org.springframework.web.filter.CharacterEncodingFilter&#60;/filter-class&#62; &#160; &#160; &#160; &#160; &#60;init-param&#62; &#160; &#160; &#160; &#160; &#160; &#160; &#60;param-name&#62;encoding&#60;/param-name&#62; &#160; &#160; &#160; &#160; &#160; &#160; &#60;param-value&#62;utf-8&#60;/param-value&#62; &#160; &#160; &#160; &#160; &#60;/init-param&#62; &#160; &#160; &#60;/filter&#62; &#160; &#160; &#60;filter-mapping&#62; &#160; &#160; &#160; &#160; &#60;filter-name&#62;Spring character encoding filter&#60;/filter-name&#62; &#160; &#160; &#160; &#160; &#60;url-pattern&#62;/*&#60;/url-pattern&#62; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>在java里可以用：request.setCharacterEncoding(&#8220;UTF-8&#8243;);</p>
<p>在Spring的Controller类里个别设置太麻烦，可以用filter</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Olive;">&lt;</span><span style="color: Green;">filter-name</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">Spring character encoding filter</span><span style="color: Olive;">&lt;/</span><span style="color: Green;">filter-name</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">filter-class</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">org.springframework.web.filter.CharacterEncodingFilter</span><span style="color: Olive;">&lt;/</span><span style="color: Green;">filter-class</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">init-param</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">param-name</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">encoding</span><span style="color: Olive;">&lt;/</span><span style="color: Green;">param-name</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">param-value</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">utf-8</span><span style="color: Olive;">&lt;/</span><span style="color: Green;">param-value</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">&lt;/</span><span style="color: Green;">init-param</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Olive;">&lt;/</span><span style="color: Green;">filter</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">filter-mapping</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">filter-name</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">Spring character encoding filter</span><span style="color: Olive;">&lt;/</span><span style="color: Green;">filter-name</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">url-pattern</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">/*</span><span style="color: Olive;">&lt;/</span><span style="color: Green;">url-pattern</span><span style="color: Olive;">&gt;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Olive;">&lt;/</span><span style="color: Green;">filter-mapping</span><span style="color: Olive;">&gt;</span></li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/07/01/set-request-chartset-to-utf8-unser-spring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android中一些关于sqlite的总结-1</title>
		<link>http://liubin.nanshapo.com/2010/06/25/somthing-about-sqlite-in-android-1/</link>
		<comments>http://liubin.nanshapo.com/2010/06/25/somthing-about-sqlite-in-android-1/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 09:57:10 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=296</guid>
		<description><![CDATA[1.数据库文件 位于：/data/data/{package} /databases文件夹中 2.SQLiteOpenHelper 的onCreate，onUpgrade  你可以扩展SQLiteOpenHelper类，它是一个Android辅助类，主要用于数据库创建和版本管理。实际上，你可以覆盖onCreate()和onUpgrade()方法 onCreate在数据库第一次被创建的时候才会调用，不用担心每次都掉用。 因为很多例子都是create table的语句，重复调用显然原来的数据会没的。 而onUpgrade则是升级的时候才会调用，看如下代码： @Override &#160; &#160; &#160; &#160; public&#160;void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { &#160; &#160; &#160; &#160; &#160; &#160; Log.w(TAG, &#34;Upgrading database from version &#34; + oldVersion + &#34; to &#34; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; + newVersion + &#34;, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>1.数据库文件<br />
</strong>位于：/data/data/{package} /databases文件夹中</p>
<p><strong>2.SQLiteOpenHelper 的onCreate，onUpgrade<br />
</strong> 你可以扩展SQLiteOpenHelper类，它是一个Android辅助类，主要用于数据库创建和版本管理。实际上，你可以覆盖onCreate()和onUpgrade()方法<br />
onCreate在数据库第一次被创建的时候才会调用，不用担心每次都掉用。<br />
因为很多例子都是create table的语句，重复调用显然原来的数据会没的。<br />
而onUpgrade则是升级的时候才会调用，看如下代码：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Gray;">@</span><span style="color: Blue;">Override</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">public</span><span style="color: Gray;">&nbsp;</span><span class="hl-types">void</span><span style="color: Gray;"> </span><span style="color: Blue;">onUpgrade</span><span style="color: Olive;">(</span><span style="color: Blue;">SQLiteDatabase</span><span style="color: Gray;"> </span><span style="color: Blue;">db</span><span style="color: Gray;">, </span><span class="hl-types">int</span><span style="color: Gray;"> </span><span style="color: Blue;">oldVersion</span><span style="color: Gray;">, </span><span class="hl-types">int</span><span style="color: Gray;"> </span><span style="color: Blue;">newVersion</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">Log</span><span style="color: Gray;">.</span><span style="color: Blue;">w</span><span style="color: Olive;">(</span><span style="color: Blue;">TAG</span><span style="color: Gray;">, </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">Upgrading database from version </span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> + </span><span style="color: Blue;">oldVersion</span><span style="color: Gray;"> + </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;"> to </span><span style="color: #8b0000;">&quot;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + </span><span style="color: Blue;">newVersion</span><span style="color: Gray;"> + </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">, which will destroy all old data</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">db</span><span style="color: Gray;">.</span><span style="color: Blue;">execSQL</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">DROP TABLE IF EXISTS test</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Blue;">onCreate</span><span style="color: Olive;">(</span><span style="color: Blue;">db</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">}</span></li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/06/25/somthing-about-sqlite-in-android-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hibernate3.2里的Transformers</title>
		<link>http://liubin.nanshapo.com/2010/06/24/transformers-in-hibernate3-2/</link>
		<comments>http://liubin.nanshapo.com/2010/06/24/transformers-in-hibernate3-2/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 08:34:45 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[hibernate]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=292</guid>
		<description><![CDATA[hibernate 里想将sql的结果转为对象，但是对象不想再.hb.xml里定义，可以考虑用 ResultTransformer 使用SQL Transformers List resultWithAliasedBean = s.createSQLQuery( &#160; &#34;SELECT st.name as studentName, co.description as courseDescription &#34; + &#160; &#34;FROM Enrolment e &#34; + &#160; &#34;INNER JOIN Student st on e.studentId=st.studentId &#34; + &#160; &#34;INNER JOIN Course co on e.courseCode=co.courseCode&#34;) &#160; .addScalar(&#34;studentName&#34;) &#160; .addScalar(&#34;courseDescription&#34;) &#160; .setResultTransformer(&#160;Transformers.aliasToBean(StudentDTO.class)) &#160; .list(); &#160; StudentDTO&#160;dto =(StudentDTO) resultWithAliasedBean.get(0); 注意，如果不加上addScalar()调用的话，可能有些属性不会被设置值，因为他们可能是用大写字母返回的。 用Map [...]]]></description>
			<content:encoded><![CDATA[<p>hibernate 里想将sql的结果转为对象，但是对象不想再.hb.xml里定义，可以考虑用 ResultTransformer</p>
<p><strong>使用SQL Transformers</strong></p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Blue;">List</span><span style="color: Gray;"> </span><span style="color: Blue;">resultWithAliasedBean</span><span style="color: Gray;"> = </span><span style="color: Blue;">s</span><span style="color: Gray;">.</span><span style="color: Blue;">createSQLQuery</span><span style="color: Olive;">(</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">SELECT st.name as studentName, co.description as courseDescription </span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> +</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">FROM Enrolment e </span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> +</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">INNER JOIN Student st on e.studentId=st.studentId </span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> +</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">INNER JOIN Course co on e.courseCode=co.courseCode</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; .</span><span style="color: Blue;">addScalar</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">studentName</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; .</span><span style="color: Blue;">addScalar</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">courseDescription</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; .</span><span style="color: Blue;">setResultTransformer</span><span style="color: Olive;">(</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">Transformers</span><span style="color: Gray;">.</span><span style="color: Blue;">aliasToBean</span><span style="color: Olive;">(</span><span style="color: Blue;">StudentDTO</span><span style="color: Gray;">.</span><span style="color: Green;">class</span><span style="color: Olive;">))</span></li>
<li><span style="color: Gray;">&nbsp; .</span><span style="color: Blue;">list</span><span style="color: Olive;">()</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span></li>
<li><span style="color: Blue;">StudentDTO</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">dto</span><span style="color: Gray;"> =</span><span style="color: Olive;">(</span><span style="color: Blue;">StudentDTO</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Blue;">resultWithAliasedBean</span><span style="color: Gray;">.</span><span style="color: Blue;">get</span><span style="color: Olive;">(</span><span style="color: Maroon;">0</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li></ol></div>
<p>注意，如果不加上addScalar()调用的话，可能有些属性不会被设置值，因为他们可能是用大写字母返回的。</p>
<p><strong>用Map</strong></p>
<p>指定Transformers.ALIAS_TO_MAP就可以了，如下所示，你不必为了在需要记忆字段对应的位置，因为他们是map</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Blue;">List</span><span style="color: Gray;"> </span><span style="color: Blue;">iter</span><span style="color: Gray;"> = </span><span style="color: Blue;">s</span><span style="color: Gray;">.</span><span style="color: Blue;">createQuery</span><span style="color: Olive;">(</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">select e.student.name as studentName,</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> +</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">&nbsp; &nbsp; &nbsp;&nbsp; e.course.description as courseDescription</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;"> +</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">from&nbsp;&nbsp; Enrolment as e</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; .</span><span style="color: Blue;">setResultTransformer</span><span style="color: Olive;">(</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">Transformers</span><span style="color: Gray;">.</span><span style="color: Blue;">ALIAS_TO_MAP</span><span style="color: Gray;"> </span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; .</span><span style="color: Blue;">iterate</span><span style="color: Olive;">()</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span></li>
<li><span style="color: Blue;">String</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">name</span><span style="color: Gray;"> = </span><span style="color: Olive;">(</span><span style="color: Blue;">Map</span><span style="color: Olive;">)(</span><span style="color: Blue;">iter</span><span style="color: Gray;">.</span><span style="color: Blue;">next</span><span style="color: Olive;">())</span><span style="color: Gray;">.</span><span style="color: Blue;">get</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">studentName</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li></ol></div>
<p>原文：<a href="http://swik.net/Hibernate/Hibernate+GroupBlog/Hibernate+3.2:+Transformers+for+HQL+and+SQL/cmxs">http://swik.net/Hibernate/Hibernate+GroupBlog/Hibernate+3.2:+Transformers+for+HQL+and+SQL/cmxs</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/06/24/transformers-in-hibernate3-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>找不到org.slf4j.impl.StaticLoggerBinder</title>
		<link>http://liubin.nanshapo.com/2010/06/21/org-slf4j-impl-staticloggerbinder-not-found/</link>
		<comments>http://liubin.nanshapo.com/2010/06/21/org-slf4j-impl-staticloggerbinder-not-found/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 07:57:02 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[技术]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=290</guid>
		<description><![CDATA[启动tomcat出错： 严重: Servlet /AppStoreServer threw load() exception java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder &#160; &#160; at&#160;org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516) &#160; &#160; at&#160;org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361) &#160; &#160; at&#160;org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:223) &#160; &#160; at&#160;org.slf4j.LoggerFactory.bind(LoggerFactory.java:120) &#160; &#160; at&#160;org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111) &#160; &#160; at&#160;org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269) &#160; &#160; at&#160;org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242) &#160; &#160; at&#160;org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:255) 原来hibernate自带了个slf4j的东西，但是不带这个，还要另外下载。]]></description>
			<content:encoded><![CDATA[<p>启动tomcat出错：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Gray;">严重: </span><span style="color: Blue;">Servlet</span><span style="color: Gray;"> /</span><span style="color: Blue;">AppStoreServer</span><span style="color: Gray;"> </span><span style="color: Blue;">threw</span><span style="color: Gray;"> </span><span style="color: Blue;">load</span><span style="color: Olive;">()</span><span style="color: Gray;"> </span><span style="color: Blue;">exception</span></li>
<li><span style="color: Blue;">java</span><span style="color: Gray;">.</span><span style="color: Blue;">lang</span><span style="color: Gray;">.</span><span style="color: Blue;">ClassNotFoundException</span><span style="color: Gray;">: </span><span style="color: Blue;">org</span><span style="color: Gray;">.</span><span style="color: Blue;">slf4j</span><span style="color: Gray;">.</span><span style="color: Blue;">impl</span><span style="color: Gray;">.</span><span style="color: Blue;">StaticLoggerBinder</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">at</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">org</span><span style="color: Gray;">.</span><span style="color: Blue;">apache</span><span style="color: Gray;">.</span><span style="color: Blue;">catalina</span><span style="color: Gray;">.</span><span style="color: Blue;">loader</span><span style="color: Gray;">.</span><span style="color: Blue;">WebappClassLoader</span><span style="color: Gray;">.</span><span style="color: Blue;">loadClass</span><span style="color: Olive;">(</span><span style="color: Blue;">WebappClassLoader</span><span style="color: Gray;">.</span><span style="color: Blue;">java</span><span style="color: Gray;">:</span><span style="color: Maroon;">1516</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">at</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">org</span><span style="color: Gray;">.</span><span style="color: Blue;">apache</span><span style="color: Gray;">.</span><span style="color: Blue;">catalina</span><span style="color: Gray;">.</span><span style="color: Blue;">loader</span><span style="color: Gray;">.</span><span style="color: Blue;">WebappClassLoader</span><span style="color: Gray;">.</span><span style="color: Blue;">loadClass</span><span style="color: Olive;">(</span><span style="color: Blue;">WebappClassLoader</span><span style="color: Gray;">.</span><span style="color: Blue;">java</span><span style="color: Gray;">:</span><span style="color: Maroon;">1361</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">at</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">org</span><span style="color: Gray;">.</span><span style="color: Blue;">slf4j</span><span style="color: Gray;">.</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">getSingleton</span><span style="color: Olive;">(</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">java</span><span style="color: Gray;">:</span><span style="color: Maroon;">223</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">at</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">org</span><span style="color: Gray;">.</span><span style="color: Blue;">slf4j</span><span style="color: Gray;">.</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">bind</span><span style="color: Olive;">(</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">java</span><span style="color: Gray;">:</span><span style="color: Maroon;">120</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">at</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">org</span><span style="color: Gray;">.</span><span style="color: Blue;">slf4j</span><span style="color: Gray;">.</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">performInitialization</span><span style="color: Olive;">(</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">java</span><span style="color: Gray;">:</span><span style="color: Maroon;">111</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">at</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">org</span><span style="color: Gray;">.</span><span style="color: Blue;">slf4j</span><span style="color: Gray;">.</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">getILoggerFactory</span><span style="color: Olive;">(</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">java</span><span style="color: Gray;">:</span><span style="color: Maroon;">269</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">at</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">org</span><span style="color: Gray;">.</span><span style="color: Blue;">slf4j</span><span style="color: Gray;">.</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">getLogger</span><span style="color: Olive;">(</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">java</span><span style="color: Gray;">:</span><span style="color: Maroon;">242</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Blue;">at</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">org</span><span style="color: Gray;">.</span><span style="color: Blue;">slf4j</span><span style="color: Gray;">.</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">getLogger</span><span style="color: Olive;">(</span><span style="color: Blue;">LoggerFactory</span><span style="color: Gray;">.</span><span style="color: Blue;">java</span><span style="color: Gray;">:</span><span style="color: Maroon;">255</span><span style="color: Olive;">)</span></li></ol></div>
<p>原来hibernate自带了个slf4j的东西，但是不带这个，还要另外下载。</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/06/21/org-slf4j-impl-staticloggerbinder-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hibernate的mappingResources和mappingDirectoryLocations</title>
		<link>http://liubin.nanshapo.com/2010/06/21/hibernate-mappingresources-mappingdirectorylocations/</link>
		<comments>http://liubin.nanshapo.com/2010/06/21/hibernate-mappingresources-mappingdirectorylocations/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 07:23:53 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[mapping]]></category>
		<category><![CDATA[mappingDirectoryLocations]]></category>
		<category><![CDATA[mappingResources]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=286</guid>
		<description><![CDATA[如果嫌mappingResources的麻烦，可以用mappingDirectoryLocations &#60;property name=&#34;mappingDirectoryLocations&#34;&#62;&#160; &#160; &#160; &#160;&#160; &#60;list&#62;&#160; &#160; &#160; &#60;value&#62;WEB-INF/rescources/com/abc&#60;/value&#62;&#160; &#160; &#160; &#160;&#160; &#60;/list&#62;&#160; &#60;/property&#62;]]></description>
			<content:encoded><![CDATA[<p>如果嫌mappingResources的麻烦，可以用mappingDirectoryLocations</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Olive;">&lt;</span><span style="color: Green;">property</span><span style="color: Gray;"> </span><span style="color: #00008b;">name</span><span style="color: Gray;">=</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">mappingDirectoryLocations</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp;&nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">list</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Olive;">&lt;</span><span style="color: Green;">value</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">WEB-INF/rescources/com/abc</span><span style="color: Olive;">&lt;/</span><span style="color: Green;">value</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; &nbsp;&nbsp; </span><span style="color: Olive;">&lt;/</span><span style="color: Green;">list</span><span style="color: Olive;">&gt;</span><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Olive;">&lt;/</span><span style="color: Green;">property</span><span style="color: Olive;">&gt;</span></li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/06/21/hibernate-mappingresources-mappingdirectorylocations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hibernate-extensions和hiberanate版本的问题</title>
		<link>http://liubin.nanshapo.com/2010/06/21/hibernate-extensions-under-hiberanate-3-5-5-final/</link>
		<comments>http://liubin.nanshapo.com/2010/06/21/hibernate-extensions-under-hiberanate-3-5-5-final/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 05:30:28 +0000</pubDate>
		<dc:creator>liubin</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[class2hbm.bat]]></category>
		<category><![CDATA[ddl2hbm.bat]]></category>
		<category><![CDATA[hbm2java.bat]]></category>
		<category><![CDATA[hibernate]]></category>
		<category><![CDATA[hibernate-extensions]]></category>
		<category><![CDATA[hibernate-tool]]></category>
		<category><![CDATA[net.sf.hibernate.MappingException]]></category>
		<category><![CDATA[setenv.bat]]></category>

		<guid isPermaLink="false">http://liubin.nanshapo.com/?p=282</guid>
		<description><![CDATA[想用hbm2java生成java代码，却出现错误： Exception in thread &#8220;main&#8221; java.lang.NoClassDefFoundError: net/sf/hibernate/MappingException Caused by: java.lang.ClassNotFoundException: net.sf.hibernate.MappingException at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: net.sf.hibernate.tool.hbm2java.CodeGenerator. Program will exit. 查了一下，原来这个MappingException在最新的hibernate里面没有了（3.5.3Final），还要在老的版本里去找。 下了一个2.1.7c的就可以了 记得要在setenv.bat里加入一行： set HIBERNATE_HOME=c:\hibernate-2.1]]></description>
			<content:encoded><![CDATA[<p>想用hbm2java生成java代码，却出现错误：<br />
Exception in thread &#8220;main&#8221; java.lang.NoClassDefFoundError: net/sf/hibernate/MappingException<br />
Caused by: java.lang.ClassNotFoundException: net.sf.hibernate.MappingException<br />
        at java.net.URLClassLoader$1.run(Unknown Source)<br />
        at java.security.AccessController.doPrivileged(Native Method)<br />
        at java.net.URLClassLoader.findClass(Unknown Source)<br />
        at java.lang.ClassLoader.loadClass(Unknown Source)<br />
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)<br />
        at java.lang.ClassLoader.loadClass(Unknown Source)<br />
Could not find the main class: net.sf.hibernate.tool.hbm2java.CodeGenerator.  Program will exit.</p>
<p>查了一下，原来这个MappingException在最新的hibernate里面没有了（3.5.3Final），还要在老的版本里去找。<br />
下了一个2.1.7c的就可以了</p>
<p>记得要在setenv.bat里加入一行：<br />
set HIBERNATE_HOME=c:\hibernate-2.1</p>
]]></content:encoded>
			<wfw:commentRss>http://liubin.nanshapo.com/2010/06/21/hibernate-extensions-under-hiberanate-3-5-5-final/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
