hibernate xml映射集错误

时间:2013-01-29 18:16:06

标签: hibernate hibernate-mapping

我想在Car和CarDetails之间实现一对多关系。 所以一辆车可以有多个CarDetails

我总是得到这个错误:

The content of element type "set" must match "(meta*,subselect?,cache?,synchronize*,comment?,key,(element|one-to-many|many-to-many|composite-element|many-to-any),loader?,sql-insert?,sql-update?,sql-delete?,sql-delete-all?,filter*)".

所以这是我的Car.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="at.opendata.entitys">      
    <class name="Car" table="Cars">

        <id name="id" column="Car_Id">
            <generator class="increment"/>
        </id>
        <set name="carDetails" table="cardetail" cascade="all">
            <key column="detail_id"/>           
            <one-to-many class="at.opendata.entitys.CarDetail"/>
        </set>  
        <property name="name"/>
        <property name="vin"/>      
        <property name="location" type="org.hibernate.spatial.GeometryType" column="location"/>

    </class>    
</hibernate-mapping>

0 个答案:

没有答案