hibernate.cfg.xml文件
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration><session-factory>
<property name="dialect">
org.hibernate.dialect.MySQL5InnoDBDialect
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/hibernate_db
</property>
<property name="connection.username">root</property>
<property name="connection.password">admin</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="myeclipse.connection.profile">mysql</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<mapping resource="it/cast/bean/grade.hbm.xml" />
<mapping resource="it/cast/bean/student.hbm.xml" /></session-factory></hibernate-configuration>
另外一个配置文件
<?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="it.cast.bean.Grade" table="grade">
<id name="id" type="integer">
<generator class="native"></generator>
</id>
<property name="address1"/>
<property name="address2"/>
<property name="address3"/>
</class>
</hibernate-mapping>
程序
@Test
public void create(){
Configuration conf = HibernateUtil.getConfiguration().configure();
SchemaExport se = new SchemaExport(conf);
se.create(true, true);
}
为什么总说我配置问题,是我的配置哪儿出错了,求各位大佬解
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration><session-factory>
<property name="dialect">
org.hibernate.dialect.MySQL5InnoDBDialect
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/hibernate_db
</property>
<property name="connection.username">root</property>
<property name="connection.password">admin</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="myeclipse.connection.profile">mysql</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hbm2ddl.auto">update</property>
<mapping resource="it/cast/bean/grade.hbm.xml" />
<mapping resource="it/cast/bean/student.hbm.xml" /></session-factory></hibernate-configuration>
另外一个配置文件
<?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="it.cast.bean.Grade" table="grade">
<id name="id" type="integer">
<generator class="native"></generator>
</id>
<property name="address1"/>
<property name="address2"/>
<property name="address3"/>
</class>
</hibernate-mapping>
程序
@Test
public void create(){
Configuration conf = HibernateUtil.getConfiguration().configure();
SchemaExport se = new SchemaExport(conf);
se.create(true, true);
}
为什么总说我配置问题,是我的配置哪儿出错了,求各位大佬解
解决方案 »
- jfreechart画图
- 一家飞机坠毁在荒岛上,幸存了10个人,直升飞机每次只能救一个人,给下列人排序:生物学家、生态学家、科学家、孕妇、天才儿童、航天员、警察、流浪汉、运动员和……忘
- el表达式中获取cookie的问题
- 求助!使用axis1.4要在返回报文中加入header信息
- myeclipse6.5下连接weblogic9出现java.io.StreamCorruptedException:invalid type code:31
- java 怎么记录用户操作
- sun portal 能否在 tomcat 上部署?
- Tomcat5.025+jdk1.4.2_04-b04连接数据库报错,怎么回事啊?
- struts 国际化问题(急)
- springmvc rest 欢迎页的问题
- 关于一个sql语句的写法
- 如何用hql查询对象里面的set集合,跟另外一张表里面的set集合有相同内容(java的HQL)
其他异常信息呢???