我的eclipse为什么这么慢呀!
先说我的机器配置
p43.0 超线程 1G 内存
winxp +jdk1.5+junit+spring+hiberate2.1+eclipse3.11
我的数据关系
cate 和video是多对多的双向关系
按照hibanete做法我引入了cate-video对象和表
video和comment是一对多的双向关系;
我hbm 文件如下
video.hbm.xml
static {
ApplicationContextFactory.init("/com/letdoo/video/dao/applicationContext-hibernate.xml");
}
public static void main(String[] args) {
junit.swingui.TestRunner.run(VideoDaoTest.class);
}
public VideoDaoTest(String arg0) {
super(arg0);
}
protected void setUp() throws Exception {
videoDao=(VideoDao)ApplicationContextFactory.getApplicationContext().getBean("videoDao");
videoLibCategroyDao=(VideoLibCategroyDao)ApplicationContextFactory.getApplicationContext().getBean("videoLibCategroyDao");
super.setUp();
}
protected void tearDown() throws Exception {
super.tearDown();
}
/*
* “com.letdoo.video.dao.VideoDao.addVideo(Video)”的测试方法
*/
public void testAddVideo() {
Date date=new Date();
VideoLibCategroy vv=videoLibCategroyDao.findVideoLibCategroyById("4028826b0a8ce70d010a8ce710be0001");
Video v=new Video();
v.setCreateTime(date);
v.setName("haohao");
VideoLibRCateVideo vr=new VideoLibRCateVideo();
vr.setVideo(v);
vr.setVideoLibCategroy(vv);
v.getVideoLibRCateVideo().add(vr);
videoDao.addVideo(v);
}
}
当测试执行的时候花了近100秒的时间:
请问这是为什么
p43.0 超线程 1G 内存
winxp +jdk1.5+junit+spring+hiberate2.1+eclipse3.11
我的数据关系
cate 和video是多对多的双向关系
按照hibanete做法我引入了cate-video对象和表
video和comment是一对多的双向关系;
我hbm 文件如下
video.hbm.xml
yDao;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class
name="com.letdoo.video.model.Video"
table="t_videolib_video"
>
<id
name="id"
column="id"
type="string"
length="32"
unsaved-value="null"
>
<generator class="uuid.hex">
</generator>
</id>
<property
name="name"
type="string"
update="true"
insert="true"
column="name"
length="50"
/>
<set
name="videoLibComment"
table="t_videoLib_comment"
cascade="all-delete-orphan"
outer-join="true"
>
<key column="videoId" />
<one-to-many class="com.letdoo.video.model.VideoLibComment" />
</set>
<set name="videoLibRCateVideo"
lazy="true"
inverse="true"
cascade="all-delete-orphan"
outer-join="true">
<key column="videoId" />
<one-to-many class="com.letdoo.video.model.VideoLibRCateVideo" />
</set>
</class>
cate.hbm.xml
</hibernate-mapping>
VideoLibCategroy.hbm.xml
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
<class
name="com.letdoo.video.model.VideoLibCategroy"
table="t_videoLib_category"
>
<id
name="id"
column="id"
type="java.lang.String"
length="32"
unsaved-value="null"
>
<generator class="uuid.hex">
</generator>
</id>
<property
name="name"
type="java.lang.String"
update="true"
insert="true"
column="name"
length="50"
/>
<set name="videoLibRCateVideo"
lazy="true"
inverse="true"
cascade="all-delete-orphan"
outer-join="true">
<key column="cateId" />
<one-to-many class="com.letdoo.video.model.VideoLibRCateVideo" />
</set>
</class>
</hibernate-mapping>
cate_video.hbm.xml
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.letdoo.video.model.VideoLibRCateVideo" table="t_videoLib_rcatevideo" >
<id
name="id"
column="id"
type="string"
length="32"
unsaved-value="null"
>
<generator class="uuid.hex">
</generator>
</id>
<many-to-one
name="videoLibCategroy"
column="cateId"
class="com.letdoo.video.model.VideoLibCategroy"
not-null="true" />
<many-to-one
name="video"
column="videoId"
class="com.letdoo.video.model.Video"
not-null="true" />
</class>
</hibernate-mapping>
comment.hbm.xml
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping
>
<class
name="com.letdoo.video.model.VideoLibComment"
table="t_videoLib_comment"
>
<id
name="id"
column="id"
type="string"
length="32"
unsaved-value="null"
>
<generator class="uuid.hex">
</generator>
</id>
<!-- many-to-one VideoLibComment to VideoLibVideo-->
<property
name="title"
type="string"
update="true"
insert="true"
column="title"
length="200"
/>
<many-to-one
name="video"
column="videoId"
class="com.letdoo.video.model.Video"
cascade="save-update"
outer-join="true"
/>
</class>
</hibernate-mapping>
package test;
import com.letdoo.pic.base.*;
import junit.framework.TestCase;
import java.util.*;
import com.letdoo.video.dao.*;
import com.letdoo.video.model.*;
public class VideoDaoTest extends TestCase {
private VideoDao videoDao;
private VideoLibCategroyDao videoL
static {
ApplicationContextFactory.init("/com/letdoo/video/dao/applicationContext-hibernate.xml");
}
public static void main(String[] args) {
junit.swingui.TestRunner.run(VideoDaoTest.class);
}
public VideoDaoTest(String arg0) {
super(arg0);
}
protected void setUp() throws Exception {
videoDao=(VideoDao)ApplicationContextFactory.getApplicationContext().getBean("videoDao");
videoLibCategroyDao=(VideoLibCategroyDao)ApplicationContextFactory.getApplicationContext().getBean("videoLibCategroyDao");
super.setUp();
}
protected void tearDown() throws Exception {
super.tearDown();
}
/*
* “com.letdoo.video.dao.VideoDao.addVideo(Video)”的测试方法
*/
public void testAddVideo() {
Date date=new Date();
VideoLibCategroy vv=videoLibCategroyDao.findVideoLibCategroyById("4028826b0a8ce70d010a8ce710be0001");
Video v=new Video();
v.setCreateTime(date);
v.setName("haohao");
VideoLibRCateVideo vr=new VideoLibRCateVideo();
vr.setVideo(v);
vr.setVideoLibCategroy(vv);
v.getVideoLibRCateVideo().add(vr);
videoDao.addVideo(v);
}
}
当测试执行的时候花了近100秒的时间:
请问这是为什么
haohao
2006-04-12 15:26:02
评论:2
阅读:674
引用:0
@2006-04-12 17:03:07 hofman
确实偏慢了,应该10秒作用。我的机器硬件配置与你相同,但用的是fc3,测试blog系统一般要10多秒,因为beans比较多。观察一下是否是xp系统问题。再者,打开log,看这100秒 eclipse在忙些什么,以此作为进一步判断的根据。
再说一句
@2006-04-12 15:29:51 haohao
我把jvm的内存给近700mb
