|
我用hibernate连接数据库,数据访问对象为:- public class DAORootAB {
- private Session session;
- /**
- * DAO构造器
- */
- public DAORootAB() {
- createSession();
- }
- public void createSession() {
- // TODO 创建会话
- System.out.println("---");
- if (this.session == null) {
- Configuration config = new AnnotationConfiguration().configure();
- SessionFactory factory = config.buildSessionFactory();
- this.session = factory.openSession();
- }
- }
- ... 其他略
复制代码 当我使用线程访问是,却无法加载这个类,跟踪程序到Configuration config = new AnnotationConfiguration().configure(); 这一行就在中断。
简单的线程如下:- public class WorkThread implements Runnable{
- @Override
- public void run(){
- DAORootAB dao = new DAORootAB();
- }
- }
复制代码 测试代码(Junit4.4),喜欢用 main测试的代码也是一样:- public class MailRunnerTC {
- @Test
- public void testname() throws Exception {
- new Thread(new WorkThread()).start();
- }
复制代码 hibernate配置文件略了。。。。急!!!!
后院各位帮帮忙[em021][em021][em021]
[ 本帖最后由 xinggg22 于 2008-5-17 12:42 编辑 ] |
|