日期:2014-05-19  浏览次数:20826 次

hibernate里面的类型问题
hibernate里面一个类型错误的异常:
pojo类:
public class Items {
private Integer id;
private String title;
private String intro;
private Date enterTime;
private Date startTime;
private Date endTime;
private Short state;
        public get....
        public set....
}
Items.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>
<!-- 
    Created by the Middlegen Hibernate plugin 2.1

    http://boss.bekk.no/boss/middlegen/
    http://www.hibernate.org/
-->
<class name="com.pojo.Items" table="items" dynamic-update="true">
    <id name="id" type="java.lang.Integer" column="id">
        <generator class="uuid.hex" />
    </id>
    <property name="title" type="java.lang.String" column="title" />
    <property name="intro" type="java.lang.String" column="intro" />
    <property name="enterTime" type="java.util.Date" column="enterTime" />
    <property name="startTime" type="java.util.Date" column="startTime" />
    <property name="endTime" type="java.util.Date" column="endTime" />
    <property name="state" type="java.lang.Short" column="state" />
    <!-- Associations -->
</class>
</hibernate-mapping>
myhibernate.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.url">
            jdbc:mysql://localhost:3306/mydb
        </property>
        <property name="hibernate.connection.driver_class">
            com.mysql.jdbc.Driver
        </property>
        <property name="hibernate.connection.username">
            root
        </property>
        <property name="hibernate.connection.password"></property>
        <property name="hibernate.dialect">
            org.hibernate.diale