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

hibernate多对一关联
出现了这样一个问题
Hibernate: insert into db_database05.book (id, name, price, author, description, categoryid) values (?, ?, ?, ?, ?)
为什么会出现id,hibernate中控制生成这句sql语句的是什么

------解决方案--------------------
XML code

<id name="classId" type="java.lang.Integer">
            <column name="class_id" />
            <generator class="increment"></generator>
        </id>
        <many-to-one name="major" class="com.muse.pojo.Major" fetch="select" lazy="false">
            <column name="major_id" />
        </many-to-one>
        <property name="className" type="java.lang.String">
            <column name="class_name" length="50" />
        </property>