从Configuration入手。在hibernate.cfg.xml中配置2个数据源后,当创建Configuration时针对2个数据源创建2个Configuration实例。之后,就是一般的orm操作。从一个源里实例化出来,在持久化到另一个源里。
解决方案 »
- 怎样可以比较简洁且高效的去二维数组中取每一个数周围的8位数,取不到的用0补上
- MyBatis 3 整合Spring3、SpringMVC出现的问题
- spring security3里把ss2中的 ConfigAttributeEditor换成那个类了
- 关于SH 框架整合的问题
- jsp 与servlet 的连接
- 关于DAO的一个小疑惑
- 大家谁会CORBA啊?我是个初学者,望大哥大姐们给点帮助
- struts加tils应用,部署在jboss上,出现乱码?从数据库上查询出来的中文可以正常显示。
- xml字符串解析成Document出错,求指导
- jdk1.5 中的StringBuffer类
- 有谁使用Spring+Hibernate同时连接两个数据库的,请指教!
- [200分]在spring中有几种依赖注入,分别是什么,怎么具体来设置使用,在构造函数的依赖注入中如果该构造函数的参数是一个Class,那该如
File file1 = new File("D:\\src\\gateway.cfg.xml");
Configuration cfg1 = new Configuration().configure(file1);
SessionFactory sessions1 = cfg1.buildSessionFactory();File file2 = new File("D:\\src\\hibernate.cfg.xml");
Configuration cfg2 = new Configuration().configure(file2);
SessionFactory sessions2 = cfg2.buildSessionFactory();就会出现缓存管理错误。如下所示:
Exception in thread "main" org.hibernate.cache.CacheException: Attempt to restart an already started EhCacheProvider. Use sessionFactory.close() between repeated calls to buildSessionFactory. Consider using net.sf.ehcache.hibernate.SingletonEhCacheProvider. Error from ehcache was: Cannot parseConfiguration CacheManager. Attempt to create a new instance of CacheManager using the diskStorePath "D:\\projects\\java\\circadian\\WebRoot\\WEB-INF\\temp" which is already used by an existing CacheManager. The source of the configuration was classpath.应该如何解决?
是hibernate-3.2.0.CR2.zip这个版本有问题.
换一个版本如:hibernate-3.2.0.CR5.zip就好了.
MyEclipse所带的一些开发包,问题多多。