估计你的Ant里面没有将hibernate.cfg.xml加到classpath里面 <path id="hibernate.path">
<pathelement path=hibernate.cfg.xml的路径/>
</path>
然后在<java>里面的classpath里加入hibernate.path
<pathelement path=hibernate.cfg.xml的路径/>
</path>
然后在<java>里面的classpath里加入hibernate.path
解决方案 »
- 怎么把string型的12小时制时间转成24小时制的字符串
- 想做单点登录的功能,但是cookie取不到
- 百度上的万年历中的清明节是怎么算出来的,逻辑是怎样的 ,在线等,有答案就结贴
- 在线查毒实现方法
- Sun Portal, OpenSSO, GlassFish, Single sign-on
- 各位前辈,高手,在深圳那个培训机构日语交的比较好!!
- 将WSAD开发的WAR包部署到Tomcat中出错
- NetBean5.0中文版下载
- **********刚学JAVA***LOMBOZ+STRUTS+ECLIPSE+TOMCA调试总也不成功,大家帮帮忙
- java.util.Date 和 java.sql.Date
- java中怎么样修改excel?
- 两个关于web service的问题,有技术的,也有非技术的。
<project name="hibernate-tutorial" default="compile">
<property name="basedir" value="."/>
<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/bin"/>
<property name="librarydir" value="${basedir}/lib"/>
<path id="libraries">
<fileset dir="${librarydir}">
<include name="*.jar"/>
</fileset>
</path>
<target name="clean">
<delete dir="${targetdir}"/>
<mkdir dir="${targetdir}"/>
</target>
<target name="compile" depends="clean,copy-resources">
<javac srcdir="${sourcedir}"
destdir="${targetdir}"
classpathref="libraries"/>
</target>
<target name="copy-resources">
<copy todir="${targetdir}">
<fileset dir="${sourcedir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="run" depends="compile">
<java fork="true" classname="EventManager" classpathref="libraries">
<classpath path="${targetdir}"/>
<arg value="${action}"/>
</java>
</target>
</project>
hibernate.cfg.xml
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration> <session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/sample</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">1234</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="transaction.factory_class">
org.hibernate.transaction.JDBCTransactionFactory
</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.HashtableCacheProvider
</property>
<property name="hibernate.hbm2ddl.auto">update</property> <mapping resource="Events.hbm.xml"/> </session-factory></hibernate-configuration>