菜鸟进军Hibernate遇到问题

来源:百度知道 编辑:UC知道 时间:2024/05/22 17:10:08
出现异常:Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not insert: [cn.itcast.hibernate.domain.User]
配置文件如下:
一:User.hbm.xml
<?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
package="cn.itcast.hibernate.domain">

<class name="User">

<id name="id">
<generator class="native"/>
</id>

<property name="name"/>
<property name="birthDay"/>
</class>

</hibernate-mapping>
二:hibernate.cfg.xml
&l

我按照你的代码 已经成功保存了数据
改了 <property name="connection.url">jdbc:mysql:///test</property>
<property name="connection.url">jdbc:mysql:/localhost/test</property>

你的错误应该跟上面代码无关

首先..之后..懂了吧.

语句编成上基本没有错误,最最主要就是你的是遇到什么问题.

你最好是把你的测试保存的代码发上来