ai ````刚开学学黑马视频的第一集就卡壳了,这个问题不解决我就没法学下去了
Uesr:- package domain;
- import java.util.Date;
- public class User {
- private int id;
- private String name;
- private Date birthday;
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public Date getBirthday() {
- return birthday;
- }
- public void setBirthday(Date birthday) {
- this.birthday = birthday;
- }
- }
复制代码 User.hbm.xml:- <?xml version="1.0"?>
- <!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
- <hibernate-mapping
- package="domain">
- <class name="User">
- <id name="id">
- <generator class="native"/>
- </id>
- <property name="name"/>
- <property name="birthday"/>
- </class>
- </hibernate-mapping>
复制代码 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.connetion.driverclass">
- com.mysql.jdbc.Driver
- </property>
- <property name="connection.url">
- jdbc:mysql://localhost/test
- </property>
- <property name="connection.username">
- root
- </property>
- <property name="connection.password">
- 5512013025
- </property>
-
- <property name="dialect">
- org.hibernate.dialect.MySQLDialect
- </property>
- </session-factory>
- </hibernate-configuration>
复制代码 问题还是那样的,wo mysql中已经创建了test表! |