hibernate关系映射

2:对对多:

表间是没有关系的,

<!-- bi-directional many-to-many association to ContentDeliveryServer --> hbm.xml文件,
    <bag
        name="contentDeliveryServers"
        lazy="true"
     cascade="save-update"
        table="T_CONTENT_CDSERVER_RELATION"
    >
        <key>
            <column name="FILE_CONTENT_ID" />
        </key>
        <many-to-many
            class="com.erry.mag.model.ContentDeliveryServer"
        >
            <column name="CD_SERVER_ID" />
        </many-to-many>
    </bag>

java类:  private List<ContentDeliveryServer> contentDeliveryServers = new ArrayList<ContentDeliveryServer>();

你可能感兴趣的:(xml,Hibernate)