1

我想在 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>
4

0 回答 0