<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>ds3783</title>
    <description></description>
    <link>http://ds3783.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
      <item>
        <title>项目开发的一点经验</title>
        <author>ds3783</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://ds3783.javaeye.com">ds3783</a>&nbsp;
          链接：<a href="http://ds3783.javaeye.com/blog/170980" style="color:red;">http://ds3783.javaeye.com/blog/170980</a>&nbsp;
          发表时间: 2008年03月13日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <strong><span style="font-size: x-large">20？80？</span></strong><br />    一直自诩为“打杂的”，简单的说，就是什么都干：项目相关文档、架构实现、自动构建、设计文档、编码，包括现在的项目在内，一直都是这样做的……<br />人的精力是有限的，即使天天加班也只能抓住那目前致命的20%时，剩下80%谁来做？低年级同学凭借能力和自信只能完成整个任务的50%，并且做的漏洞百出的时候，导致的结果只能是不得不推迟发布期。<br />结论是，虽然只做了20%，但需要检查验证的是100%。<br /><br /><br /><strong><span style="font-size: x-large">代码的价值？</span></strong><br />    有人说代码是不值钱的，又有人说代码是很值钱的。前者说随便找个程序员都能弄出来一堆代码，后者说那些代码都是程序员用血汗写出来的。结论是完美无误的代码才值钱，代码中有一点瑕疵都有可能导致整段代码作废。<br />    曾经看到过青年导报的一篇文章报道公司老员工能够创造不止3倍于新员工的价值，最根本的原因在于老员工懂得把事情做到位，回想很长一段时间来做的事情都不是很到位，忏悔。<br /><br /><br /><strong><span style="font-size: x-large">文档、约束与时间</span></strong><br />    阅读文档被很多人当成是浪费时间的事情，因为之前读过了。但是当事情出了问题却在抱怨文档中没有说明。<br />认真反复阅读软件工程上一级甚至上N级流转下来的文档，只会带来无比巨大的好处，而不会影响任何的进度问题。一个项目经理或者测试人员能够把需求文档熟读到倒背如流的程度，无疑这个项目是成功的。<br /><br /><br /><strong><span style="font-size: x-large">可怕的测试</span></strong><br />    曾经有两天出差时间，于是让A同学根据设计做编码，让B同学根据设计写单元测试代码，并且特地对B同学强调“你觉得A会出什么错误你就怎么写测试，但你不要问A这个错误会不会出现”。出差回来了解到情况是，编码完成，并且所有测试都通过了。打开IDE一看，而测试代码仅仅针对每个接口的每个方法做了相应基本流的一般测试（测试数据基本上没有代表性）。找到B同学问：“写了这么多对CRUD的测试有没有测试出什么问题？”答曰：“有，比如保存之后没有flush……”当时拿刀杀人的心都有了。<br />测试应该从需求出发，按照每个需求中描述的特性进行针对性的测试，针对领域模型的测试应该是对领域层中实现的每个用例进行测试。测试代码也需要从需求出发，好好设计一番。PS：真的很佩服B同学那么有耐心的写了好多new XX()然后调用了每个setXXXX方法，仅仅为了测试两行代码：<br />getHibernateTemplete().saveOrUpdate(obj);<br />getHibernateTemplete().flush();<br /><br /><br /><strong><span style="font-size: x-large">文档？文档！</span></strong><br />    某日，正在紧张编码中，突然MSN上A同学找我：<br /><div class="quote_title">引用</div><div class="quote_div"><br />同学A：XXX功能的保存方法出错了<br />我：什么错误？<br />同学A：是个空？<br />我：空是什么东西？<br />(1分钟后)<br />同学A：这是抓图（抓图中错误信息是null）<br />我：看看什么异常？<br />同学A：……NullPointerException<br />我：堆栈呢？<br />同学A：java.lang.NullPointerException:null <br />at com.company.xxxxxxxx……<br /></div><br />    上述问题了解问题花了3分钟，解决问题花了1分钟，整理回原来的思路花了5分钟。<br />    另一次，与测试组讨论中：<br /><div class="quote_title">引用</div><div class="quote_div"><br />同学B：XXXX流程走不通。<br />我：怎么走不通？<br />同学B：XX操作的时候出了一个错。<br />我：我刚刚测试是好的啊，你那边出了什么错？<br />同学B：那是个什么什么错，一串英文。<br />我：那串英文是什么？<br />同学B：你看发给你的错误报告文档，那里面应该有。<br />（转到错误文档，找了半天发现一句“XXXXXX，上报出错”，汗……）<br />同学B：（很不好意思地）我机器上有抓图。<br />我：你机器IP是？<br />同学B：192.168.0.XXX<br />我：？远程桌面连不上？<br />同学B：哦，我远程桌面没开。<br />我：文件共享呢？<br />同学B：我也给关了。<br />我：那我怎么访问到你的机器？<br />同学B：好像访问不到<br />（沉默……）<br />同学B：（更不好意思地）我下楼把图片发给你把<br />（于是，勤劳的B同学就在19楼和13楼中又跑了一个来回）<br />PS:公司测试部门在13楼，会议室在19楼<br /></div><br />    文字比语言更能够达到有效沟通的目的，我们的客户能够在反馈问题的时候把错误屏幕截图和堆栈异常粘贴出来，我们为什么不能呢？
          <br/>
          <span style="color:red;">
            <a href="http://ds3783.javaeye.com/blog/170980#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Thu, 13 Mar 2008 22:25:56 +0800</pubDate>
        <link>http://ds3783.javaeye.com/blog/170980</link>
        <guid>http://ds3783.javaeye.com/blog/170980</guid>
      </item>
      <item>
        <title>拽拽新买的机器</title>
        <author>ds3783</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://ds3783.javaeye.com">ds3783</a>&nbsp;
          链接：<a href="http://ds3783.javaeye.com/blog/134506" style="color:red;">http://ds3783.javaeye.com/blog/134506</a>&nbsp;
          发表时间: 2007年10月22日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <p>配置如下：</p><div align="center"><table cellspacing="0" border="0" align="center" style="width: 418pt; border-collapse: collapse" width="557" cellpadding="0"><tbody><tr height="20" style="height: 15pt"><td class="xl24" height="20" style="width: 54pt; height: 15pt" width="72">配件</td><td class="xl25" style="width: 125pt" width="166">规格</td><td class="xl25" style="width: 54pt" width="72">数量</td><td class="xl25" style="width: 45pt" width="60">单价</td><td class="xl25" style="width: 54pt" width="72">总价</td><td class="xl25" style="width: 86pt" width="115">备注</td></tr><tr height="20" style="height: 15pt"><td class="xl26" height="20" style="width: 54pt; height: 15pt" width="72">CPU</td><td class="xl27" style="width: 125pt" width="166">AMD Athlon 4000+</td><td class="xl28" style="width: 54pt" width="72">1</td><td class="xl29" style="width: 45pt" width="60">￥490.00</td><td class="xl30" style="width: 54pt" width="72">￥490.00</td><td class="xl31" style="border-top: medium none; width: 86pt" width="115">市场购买</td></tr><tr height="31" style="height: 23.25pt"><td class="xl26" height="31" style="width: 54pt; height: 23.25pt" width="72">内存</td><td class="xl27" style="width: 125pt" width="166">Geil 千禧条 1G DDRII 800MHz</td><td class="xl28" style="width: 54pt" width="72">2</td><td class="xl30" style="width: 45pt" width="60">￥245.00</td><td class="xl30" style="width: 54pt" width="72">￥490.00</td><td class="xl31" style="border-top: medium none; width: 86pt" width="115">市场购买</td></tr><tr height="17" style="height: 12.75pt"><td class="xl26" height="17" style="width: 54pt; height: 12.75pt" width="72">主板</td><td class="xl27" style="width: 125pt" width="166">技嘉 GA-MA69G-S3H</td><td class="xl28" style="width: 54pt" width="72">1</td><td class="xl29" style="width: 45pt" width="60">￥604.00</td><td class="xl30" style="width: 54pt" width="72">￥604.00</td><td class="xl31" style="border-top: medium none; width: 86pt" width="115">网上邮购</td></tr><tr height="20" style="height: 15pt"><td class="xl26" height="20" style="width: 54pt; height: 15pt" width="72">硬盘</td><td class="xl27" style="width: 125pt" width="166">西部数据 160G</td><td class="xl28" style="width: 54pt" width="72">1</td><td class="xl29" style="width: 45pt" width="60">￥450.00</td><td class="xl30" style="width: 54pt" width="72">￥450.00</td><td class="xl31" style="border-top: medium none; width: 86pt" width="115">市场购买</td></tr><tr height="20" style="height: 15pt"><td class="xl26" height="20" style="width: 54pt; height: 15pt" width="72">光驱</td><td class="xl27" style="width: 125pt" width="166">先锋DVD</td><td class="xl28" style="width: 54pt" width="72">1</td><td class="xl30" style="width: 45pt" width="60">￥155.00</td><td class="xl30" style="width: 54pt" width="72">￥155.00</td><td class="xl31" style="border-top: medium none; width: 86pt" width="115">市场购买</td></tr><tr height="20" style="height: 15pt"><td class="xl26" height="20" style="width: 54pt; height: 15pt" width="72">键盘</td><td class="xl27" style="width: 125pt" width="166">不要</td><td class="xl28" style="width: 54pt" width="72">0</td><td class="xl30" style="width: 45pt" width="60">￥0.00</td><td class="xl30" style="width: 54pt" width="72">￥0.00</td><td class="xl31" style="border-top: medium none; width: 86pt" width="115">　</td></tr><tr height="20" style="height: 15pt"><td class="xl26" height="20" style="width: 54pt; height: 15pt" width="72">鼠标</td><td class="xl27" style="width: 125pt" width="166">不要</td><td class="xl28" style="width: 54pt" width="72">0</td><td class="xl30" style="width: 45pt" width="60">￥0.00</td><td class="xl30" style="width: 54pt" width="72">￥0.00</td><td class="xl31" style="border-top: medium none; width: 86pt" width="115">　</td></tr><tr height="20" style="height: 15pt"><td class="xl26" height="20" style="width: 54pt; height: 15pt" width="72">机箱</td><td class="xl27" style="width: 125pt" width="166">杂牌坚固机箱</td><td class="xl28" style="width: 54pt" width="72">1</td><td class="xl30" style="width: 45pt" width="60">￥105.00</td><td class="xl30" style="width: 54pt" width="72">￥105.00</td><td class="xl31" style="border-top: medium none; width: 86pt" width="115">市场购买</td></tr><tr height="31" style="height: 23.25pt"><td class="xl26" height="31" style="width: 54pt; height: 23.25pt" width="72">电源</td><td class="xl27" style="width: 125pt" width="166">航嘉冷静王钻石版300W额定功率</td><td class="xl28" style="width: 54pt" width="72">1</td><td class="xl30" style="width: 45pt" width="60">￥210.00</td><td class="xl30" style="width: 54pt" width="72">￥210.00</td><td class="xl31" style="border-top: medium none; width: 86pt" width="115">市场购买</td></tr><tr height="20" style="height: 15pt"><td class="xl26" height="20" style="width: 54pt; height: 15pt" width="72">其他</td><td class="xl27" style="width: 125pt" width="166">无</td><td class="xl28" style="width: 54pt" width="72">　</td><td class="xl32">　</td><td class="xl33" align="right" style="border-top: medium none; border-left: medium none; width: 54pt" width="72">￥0.00</td><td class="xl33" style="border-top: medium none; border-left: medium none; width: 86pt" width="115">　</td></tr><tr height="20" style="height: 15pt"><td class="xl26" height="20" style="width: 54pt; height: 15pt" width="72">合计</td><td class="xl28" style="width: 125pt" width="166">　</td><td class="xl28" style="width: 54pt" width="72">　</td><td class="xl32">　</td><td class="xl33" align="right" style="border-top: medium none; border-left: medium none; width: 54pt" width="72">￥2,504.00</td><td class="xl33" style="border-top: medium none; border-left: medium none; width: 86pt" width="115">　</td></tr></tbody></table></div><p>&nbsp;</p><p>&nbsp;</p>
          <br/>
          <span style="color:red;">
            <a href="http://ds3783.javaeye.com/blog/134506#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 22 Oct 2007 17:50:22 +0800</pubDate>
        <link>http://ds3783.javaeye.com/blog/134506</link>
        <guid>http://ds3783.javaeye.com/blog/134506</guid>
      </item>
      <item>
        <title>开发环境Oracle向Sybase迁移心得</title>
        <author>ds3783</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://ds3783.javaeye.com">ds3783</a>&nbsp;
          链接：<a href="http://ds3783.javaeye.com/blog/128411" style="color:red;">http://ds3783.javaeye.com/blog/128411</a>&nbsp;
          发表时间: 2007年09月30日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <span style="font-family: 宋体"><span style="font-size: small">&nbsp; <p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-family: 宋体">负责的项目要迁移到</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">，本身工期就紧，而数据库迁移的事情谁都不提。公司的</span><span><span style="font-family: Times New Roman">DBA</span></span><span style="font-family: 宋体">即没有</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">的经验，又没有时间搭理我们。手下几个兄弟都在忙着赶工，于是决定自己干，</span><span><span style="font-family: Times New Roman">NND</span></span><span style="font-family: 宋体">！</span><span style="color: white"><span style="color: #ffffff; font-family: Times New Roman">CyberDs.</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-family: 宋体">项目原有的架构中对数据库的访问是用</span><span><span style="font-family: Times New Roman">Hibernate</span></span><span style="font-family: 宋体">对</span><span><span style="font-family: Times New Roman">JDBC</span></span><span style="font-family: 宋体">进行了封装。所以程序方面需要处理一下问题：</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 39pt; text-indent: -18pt; tab-stops: list 39.0pt"><span style="font-family: Times New Roman"><span><span>1.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-style: normal; font-variant: normal"><span style="font-size: small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span>Hibernate</span></span><span style="font-family: 宋体">映射文件</span><span><span style="font-family: Times New Roman">(.hbm.xml)</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 39pt; text-indent: -18pt; tab-stops: list 39.0pt"><span><span><span style="font-family: Times New Roman">2.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-style: normal; font-variant: normal"><span style="font-size: small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="font-family: 宋体">建表</span><span><span style="font-family: Times New Roman">SQL <span style="color: white"><span style="color: #ffffff">CyberDs.</span></span></span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 39pt; text-indent: -18pt; tab-stops: list 39.0pt"><span><span><span style="font-family: Times New Roman">3.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-style: normal; font-variant: normal"><span style="font-size: small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="font-family: 宋体">代码和原始数据插入脚本</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-family: 宋体">首先说映射文件，最初是数据类型这个不难只是要多加注意，下面给出用到的对应关系表</span></p><table class="MsoTableGrid" cellspacing="0" border="1" style="border-collapse: collapse; border: medium none" cellpadding="0"><tbody><tr><td valign="top" style="padding-right: 5.4pt; padding-left: 5.4pt; padding-bottom: 0cm; width: 213.05pt; padding-top: 0cm; background-color: transparent; border: windowtext 1pt solid" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Oracle</span></span><span style="font-family: 宋体">数据类型</span><span><span style="font-family: Times New Roman">(</span></span><span style="font-family: 宋体">不分大小写</span><span><span style="font-family: Times New Roman">)</span></span></p></td><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; border-left-color: #d4d0c8; padding-bottom: 0cm; width: 213.05pt; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">数据类型（均为小写）</span></p></td></tr><tr><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Char</span></span></p></td><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; border-left-color: #d4d0c8; padding-bottom: 0cm; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Char</span></span></p></td></tr><tr><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Varchar2 <span style="color: white"><span style="color: #ffffff">CyberDs.</span></span></span></span></p></td><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; border-left-color: #d4d0c8; padding-bottom: 0cm; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Varchar</span></span></p></td></tr><tr><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Number(m,n)</span></span></p></td><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; border-left-color: #d4d0c8; padding-bottom: 0cm; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Numeric(m,n)</span></span></p></td></tr><tr><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Date</span></span></p></td><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; border-left-color: #d4d0c8; padding-bottom: 0cm; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Datetime</span></span></p></td></tr><tr><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Timestamp(6)</span></span></p></td><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; border-left-color: #d4d0c8; padding-bottom: 0cm; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Datetime <span style="color: white"><span style="color: #ffffff">CyberDs.</span></span></span></span></p></td></tr><tr><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Integer</span></span></p></td><td valign="top" style="border-right: windowtext 1pt solid; padding-right: 5.4pt; padding-left: 5.4pt; border-left-color: #d4d0c8; padding-bottom: 0cm; width: 213.05pt; border-top-color: #d4d0c8; padding-top: 0cm; border-bottom: windowtext 1pt solid; background-color: transparent" width="284"><p class="MsoNormal" style="margin: 0cm 0cm 0pt"><span><span style="font-family: Times New Roman">Int</span></span></p></td></tr></tbody></table><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-family: 宋体">另外</span><span><span style="font-family: Times New Roman">Oracle</span></span><span style="font-family: 宋体">的主键是依赖</span><span><span style="font-family: Times New Roman">sequence</span></span><span style="font-family: 宋体">的，</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">跟</span><span><span style="font-family: Times New Roman">mySQL</span></span><span style="font-family: 宋体">一样是依赖自增列做主键的。所以把映射文件中</span><span><span style="font-family: Times New Roman">id.class</span></span><span style="font-family: 宋体">属性改成</span><span><span style="font-family: Times New Roman">native</span></span><span style="font-family: 宋体">（后面有关</span><span><span style="font-family: Times New Roman">sequence</span></span><span style="font-family: 宋体">的配置可以不改，这样就可以适用与所有数据库了）。</span><span style="color: white"><span style="color: #ffffff; font-family: Times New Roman">CyberDs.</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-family: 宋体">建表</span><span><span style="font-family: Times New Roman">SQL</span></span><span style="font-family: 宋体">是从映射文件由程序生成的，把映射文件改好后，建表</span><span><span style="font-family: Times New Roman">SQL</span></span><span style="font-family: 宋体">就有了，但这里注意需要人工在最后一句</span><span><span style="font-family: Times New Roman">drop table</span></span><span style="font-family: 宋体">语句后和文件末尾增加</span><span><span style="font-family: Times New Roman">go</span></span><span style="font-family: 宋体">命令，和</span><span><span style="font-family: Times New Roman">SQL99</span></span><span style="font-family: 宋体">中</span><span><span style="font-family: Times New Roman">Commit</span></span><span style="font-family: 宋体">一个效果。这里注意：</span><span><span style="font-family: Times New Roman">DDL</span></span><span style="font-family: 宋体">语句在</span><span><span style="font-family: Times New Roman">Oracle</span></span><span style="font-family: 宋体">中是自动提交的，但是在</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">中是存在在一个事务里面。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-family: 宋体">原始数据脚本的修改更让人感觉可笑，</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">是用回车作为</span><span><span style="font-family: Times New Roman">SQL</span></span><span style="font-family: 宋体">的结尾，而</span><span><span style="font-family: Times New Roman">Oracle</span></span><span style="font-family: 宋体">是</span><span><span style="font-family: Times New Roman">&rsquo;;&rsquo;</span></span><span style="font-family: 宋体">，所以原始数据脚本中出现回车断行的统统都要改成</span><span><span style="font-family: Times New Roman">1</span></span><span style="font-family: 宋体">行，谢天谢地，还有正则表达式帮忙，一个替换全部搞定（也许有更好的办法，偶也是刚刚接触</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">，所以如果有还望不吝赐教）。另外就是</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">不支持从字符串类型到数字类型的隐式转换（愤怒，简直笨死了）。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-family: 宋体">大体的思路就是如上，由于我们是开发，所以数据库配置管理、调优什么的统统不管</span><span><span style="font-family: Times New Roman">,</span></span><span style="font-family: 宋体">能玩就行。下面我想说说我在今天一天的痛苦经历中总结的经验和遇到的问题：</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt; text-indent: -34.5pt; tab-stops: list 55.5pt"><span style="font-family: Times New Roman"><span><span>1.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-style: normal; font-variant: normal"><span style="font-size: small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span>IDENTITY_INSERT</span></span><span style="font-family: 宋体">问题，如果您用</span><span><span style="font-family: Times New Roman">M$</span></span><span style="font-family: 宋体">的产品，那么可以跳过这条看后面去了。</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">默认对</span><span><span style="font-family: Times New Roman">identity</span></span><span style="font-family: 宋体">的字段是不允许</span><span><span style="font-family: Times New Roman">insert</span></span><span style="font-family: 宋体">和</span><span><span style="font-family: Times New Roman">update</span></span><span style="font-family: 宋体">的，所以需要设置</span><span><span style="font-family: Times New Roman">IDENTITY_INSERT</span></span><span style="font-family: 宋体">选项，这个选择虽说是针对某个表设置的，但如果你对表</span><span><span style="font-family: Times New Roman">A</span></span><span style="font-family: 宋体">打开设置后，你就不能再对表</span><span><span style="font-family: Times New Roman">B</span></span><span style="font-family: 宋体">设置它了，这点要切记。在</span><span><a href="http://technet.microsoft.com/zh-cn/library/ms188059.aspx"><span style="font-family: Times New Roman">M$</span><span style="font-family: 宋体"><span>的文档</span></span></a></span><span style="font-family: 宋体">帮助下（就是微软的文档，这里不得不感叹微软文档写得好啊。</span><span><span style="font-family: Times New Roman">PS</span></span><span style="font-family: 宋体">：</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">和</span><span><span style="font-family: Times New Roman">M$</span></span><span style="font-family: 宋体">数据库产品都是使用一样的</span><span><span style="font-family: Times New Roman">SQL</span></span><span style="font-family: 宋体">语言叫</span><span><span style="font-family: Times New Roman">Transact-SQL</span></span><span style="font-family: 宋体">），终于解决此问题，下面给出</span><span><span style="font-family: Times New Roman">SQL</span></span><span style="font-family: 宋体">样本</span><span><span style="font-family: Times New Roman">: <span style="color: white"><span style="color: #ffffff">CyberDs.</span></span></span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt"><span><span style="font-family: Times New Roman">SET IDENTITY_INSERT table_name ON</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt"><span><span style="font-family: Times New Roman">Insert into table_name values &hellip;&hellip;</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt"><span><span style="font-family: Times New Roman">Update table_name set &hellip;&hellip;<span style="color: white"><span style="color: #ffffff">CyberDs.</span></span></span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt"><span><span style="font-family: Times New Roman">SET IDENTITY_INSERT dbo.Tool OFF</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt; text-indent: -34.5pt; tab-stops: list 55.5pt"><span><span><span style="font-family: Times New Roman">2.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-style: normal; font-variant: normal"><span style="font-size: small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="font-family: 宋体">中文字符集的问题，测试表结构和数据都准备好了，然后兴致冲冲的启动</span><span><span style="font-family: Times New Roman">Tomcat</span></span><span style="font-family: 宋体">，发现从数据库中读出的中文都是乱码，那个叫汗。最后，还要感谢万能的互联网，感谢无私的汪涛，具体解决方案，</span><span><a href="http://blog.csdn.net/kingspider/archive/2006/03/03/614575.aspx"><span style="font-family: 宋体"><span>看这里</span></span></a></span><span style="font-family: 宋体">。当然，在这里我也做了一些扩展，自己制作了</span><span><span style="font-family: Times New Roman">cp936</span></span><span style="font-family: 宋体">的</span><span><span style="font-family: Times New Roman">nocase</span></span><span style="font-family: 宋体">排序，解决了</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">对表名、列名大小写的区分，呵呵，具体方法？原谅我卖个官子，万能的互联网吧，很简单的：）</span><span style="color: white"><span style="color: #ffffff; font-family: Times New Roman">CyberDs.</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt"><span style="font-family: 宋体">使用</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">开发要注意的几个问题：</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt; text-indent: -34.5pt; tab-stops: list 55.5pt"><span><span><span style="font-family: Times New Roman">1.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-style: normal; font-variant: normal"><span style="font-size: small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="font-family: 宋体">虽然</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">对</span><span><span style="font-family: Times New Roman">DML</span></span><span style="font-family: 宋体">语句不区分大小写，但是对数据类型是区分大小写的，而且是只认小写。</span><span style="color: white"><span style="color: #ffffff; font-family: Times New Roman">CyberDs.</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt; text-indent: -34.5pt; tab-stops: list 55.5pt"><span style="font-family: Times New Roman"><span><span>2.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-style: normal; font-variant: normal"><span style="font-size: small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span><span>Sybase</span></span><span style="font-family: 宋体">和</span><span><span style="font-family: Times New Roman">Oracle</span></span><span style="font-family: 宋体">差不多都是按数据库、用户管理表、数据、存储过程和各种用户对象的，但由于其提供的用户角色实在太少，而且很不方便，所以建议一个用户单独建立一个数据库，并为设置其为该数据库的</span><span><span style="font-family: Times New Roman">owner</span></span><span style="font-family: 宋体">，这样在开发过程中能省去不少麻烦。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt; text-indent: -34.5pt; tab-stops: list 55.5pt"><span><span><span style="font-family: Times New Roman">3.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-style: normal; font-variant: normal"><span style="font-size: small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="font-family: 宋体">分配足够的数据库空间，本身开发数据库不会像生产数据库那样硕大无比。目前还没有弄清楚数据库空间自增如何配置，这点确实没有</span><span><span style="font-family: Times New Roman">oracle</span></span><span style="font-family: 宋体">方便，但是一旦数据库满了，就把所有事情都阻塞了，但是只是给出警告说日志段空间接近不足，某些事务可能被阻塞。</span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 55.5pt; text-indent: -34.5pt; tab-stops: list 55.5pt"><span><span><span style="font-family: Times New Roman">4.<span style="font-weight: normal; font-size: 7pt; line-height: normal; font-style: normal; font-variant: normal"><span style="font-size: small">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span></span></span><span style="font-family: 宋体">重视自动化测试，一旦数据库移植完成，立刻跑测试，能发现很多问题。</span><span style="color: white"><span style="color: #ffffff; font-family: Times New Roman">CyberDs.</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt"><span style="font-family: 宋体">最后，刚刚接触</span><span><span style="font-family: Times New Roman">Sybase</span></span><span style="font-family: 宋体">，欢迎大家提出意见，也希望有机会多多交流，共同进步。</span><span style="color: white"><span style="color: #ffffff; font-family: Times New Roman">CyberDs.</span></span></p><p>&nbsp;</p><p class="MsoNormal" style="margin: 0cm 0cm 0pt 21pt"><span style="font-family: Times New Roman"><span style="color: white">(</span><span>(</span></span><span style="font-family: 宋体">本文属原创作品，如需转载，必须标明作者</span><span><span style="font-family: Times New Roman">Ds.3783</span></span><span style="font-family: 宋体">和出处链接</span><span><span style="font-family: Times New Roman">)</span></span></p><p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 21pt">&nbsp;</p></span></span>
          <br/>
          <span style="color:red;">
            <a href="http://ds3783.javaeye.com/blog/128411#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sun, 30 Sep 2007 10:14:27 +0800</pubDate>
        <link>http://ds3783.javaeye.com/blog/128411</link>
        <guid>http://ds3783.javaeye.com/blog/128411</guid>
      </item>
  </channel>
</rss>