if ('_'!=buf.charAt(i-1) &&
Character.isUpperCase( buf.charAt(i) ) &&
!Character.isUpperCase( buf.charAt(i+1) )
) {
buf.insert(i++, '_');
}
}
return buf.toString().toLowerCase();
}
按大写分开,加上"_",然后返回小写的toString();
SettingFactory类:设置属性类。tw.winGwit.COm
其中有buildSettings(Properties properties)方法,设置自定义属性。
Mapping类:有点不清楚。
设置类和表之间的映射。class 进去,table出来。:)(了解不清晰。)
Binding类:PO和数据库中表及其之间的映射的绑定。
Configuration类,配置类
Configuration()构建器,调用reset(),重置参数。
还有addClass(),addFile(),add(document.nbsp;doc) ,addDirectory(),addJar(),addInputString(),addResoure()等一系列方法,通过不同的资源进行配置。
还有通过不同参数重构了许多configure()方法。
configure()通过hibernate.cfg.xml配置。
/**
* Use the mappings and properties specified in an application
* resource named hibernate.cfg.xml.
*/
public Configuration configure() throws HibernateException {
configure("/hibernate.cfg.xml");
return this;
}
然后比较重要的是生成SessionFactory;
public SessionFactory buildSessionFactory() throws HibernateException {
secondPassCompile();
validate();
Environment.verifyProperties(properties);
Properties copy = new Properties();
copy.putAll(properties);
Settings settings = buildSettings();
configureCaches(settings);
return new SessionFactoryImpl(this, settings);
}
其他的一些就是通过配置文件设置各种属性。比如数据库方言Dialect等。