在myeclipse中使用hibernate進行“Hibernate Reverse Engineering”報如下錯:
!ENTRY org.eclipse.core.jobs 4 2 2010-12-27 14:20:11.625
!MESSAGE An internal error occurred during: "Generating Artifacts".
!STACK 0
java.lang.IllegalArgumentException: Path must include project and resource name: /
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:62)
at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:1631)
at org.eclipse.core.internal.resources.Container.getFile(Container.java:123)
at com.genuitec.eclipse.hibernate.util.HibernateUtils.getConfigFile(HibernateUtils.java:510)
at com.genuitec.eclipse.hibernate.util.HTUtils.getConsoleConfigurationPreferences(HTUtils.java:184)
at com.genuitec.eclipse.hibernate.util.HTUtils.getConsoleConfiguration(HTUtils.java:175)
at com.genuitec.eclipse.hibernate.util.HTUtils.getConsoleConfiguration(HTUtils.java:165)
at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:361)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
解決方案:
修改.myhibernatedata(工程下)文件裡面的configFile屬性
指定applicationContext.xml路徑。格式是/項目名稱/路徑/applicationContext.xml
.myhibernatedata文件
#
#Sat Sep 19 15:30:33 CST 2009
genBasicCompId=true
sessionFactoryName=liss.samples.myssh2.domain.HibernateSessionFactory
profile=
daoSFId=
version=3.3
jndiPath=
springDaoFile=
useJavaTypes=true
keyGenerator=increment
libInstallFolder=
addLibs2Project=false
genVersionTag=true
sessionFactoryId=
basePersistenceClass=
reSettingsFile=/myssh2/hibernate.reveng.xml
configFile=/myssh2/conf/applicationContext.xml
createConfigFile=false
addLibs2Classpath=false
baseDaoClass=BaseHibernateDAO