香草的天空::Vanilla Sky

 
 

常用链接

  • 我的随笔
  • 我的评论
  • 我的参与
  • 最新评论

留言簿(2)

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔分类

  • J2EE (rss)
  • Java/J2EE的奇怪问题(1) (rss)
  • Perl (rss)
  • 安装/编译/配置 (rss)
  • 灌水区 (rss)
  • 读Java源代码 (rss)

随笔档案

  • 2008年2月 (7)

文章档案

  • 2008年2月 (2)

搜索

  •  

最新评论

  • 1. re: 也被税务局找上了
  • 找你干啥?找你一起发财?
  • --魔域私服
  • 2. re: 如何在代码中检查出有字符串相加的情况?
  • 评论内容较长,点击标题查看
  • --香草的天空
  • 3. re: 如何在代码中检查出有字符串相加的情况?
  • StringBuffer大多时候不如+可读性高,尤其当只有两三个字符串拼接时,写成StringBuffer性能不会有多大提升,而可读性下降,非常不值得。
  • --鼠标
  • 4. re: 如何在代码中检查出有字符串相加的情况?
  • 思路不错……
  • --uwxy
  • 5. re: 如何在代码中检查出有字符串相加的情况?
  • 评论内容较长,点击标题查看
  • --pover

阅读排行榜

  • 1. 动态载入jdbc 驱动Jar。J2SE4-J2SE5专用(386)
  • 2. 读Hibernate3.2代码,(一)Configuration(326)
  • 3. MalformInputException,fontmanager.dll错(248)
  • 4. SVN Source Host(208)
  • 5. 原来在Sametime里点击下照片素会放大滴,小白了(204)

评论排行榜

  • 1. 也被税务局找上了(1)
  • 2. SVN Source Host(0)
  • 3. 读Hibernate3.2代码,(一)Configuration(0)
  • 4. 随便聊聊(0)
  • 5. 原来在Sametime里点击下照片素会放大滴,小白了(0)

Powered by: 博客园
模板提供:沪江博客
BlogJava | 首页 | 发新随笔 | 发新文章 | 联系 | 聚合 | 管理

2008年2月18日

MalformInputException,fontmanager.dll错
如果是报在ByteToCharGB18030的话,
删除奇怪的中文字体(最好把非windows自带的东亚字体都删掉)
posted @ 2008-02-29 10:58 香草的天空 阅读(248) | 评论 (0) | 编辑 收藏
 
也被税务局找上了
其实税务局那群人肯定一年超过12万的,他们不申报却来找我?
没天理

posted @ 2008-02-23 15:36 香草的天空 阅读(184) | 评论 (1) | 编辑 收藏
 
SVN Source Host
svn checkout http://allenofchina-db.googlecode.com/svn/trunk/ allenofchina-db-read-only



HP:http://heyesh.hp.infoseek.co.jp/
posted @ 2008-02-19 09:17 香草的天空 阅读(208) | 评论 (0) | 编辑 收藏
 
读Hibernate3.2代码,(一)Configuration
OpenSource的东西有点好处就是有问题随时可以看代码解决。
但是读代码也有诀窍,就是尽可能的抓住和你有关的那部分,不要在一大堆代码里浪费时间。

第一个挑出org.hibernate.cfg.Configuration。因为这个东西用得最多。

例如addXXXX方法最后都调用到add方法,一下子就可以跳过N多段代码直接看add方法

    protected void add(org.dom4j.Document doc) throws MappingException {
        HbmBinder.bindRoot( doc, createMappings(), CollectionHelper.EMPTY_MAP );
    }


bindRoot方法稍微看了一下,一看到是解析xml的,就可以跳过不看。其实猜也能猜到是解析hbm.xml的。

有意思的是".hbm.xml"在里面是固定写死的,连个constant 变量都没有做,看来作者以后是不打算改了

且看addDirectory方法
    /**
     * Read all mapping documents from a directory tree.
     * <p/>
     * Assumes that any file named <tt>*.hbm.xml</tt> is a mapping document.
     *
     * 
@param dir The directory
     * 
@return this (for method chaining purposes)
     * 
@throws MappingException Indicates problems reading the jar file or
     * processing the contained mapping documents.
     
*/
    
public Configuration addDirectory(File dir) throws MappingException {
        File[] files 
= dir.listFiles();
        
for ( int i = 0; i < files.length ; i++ ) {
            
if ( files[i].isDirectory() ) {
                addDirectory( files[i] );
            }
            
else if ( files[i].getName().endsWith( ".hbm.xml" ) ) {
                addFile( files[i] );
            }
        }
        
return this;
    }

这段代码告诉我们什么?告诉我们".hbm.xml"素区分大小写的。。。。.HBM.XML这样的后缀名作者不打算接受。。。

posted @ 2008-02-18 23:37 香草的天空 阅读(326) | 评论 (0) | 编辑 收藏