映射的摘录:
<entity class= "org.sm.EndpointList" >
<table name= "ENDPOINT_LIST" />
<attributes>
...
<many-to-many name= "endpoints">
<join-table name= "ENDPOINT_LIST_TO_ENDPOINTS" >
<join-column name= "fk_endpoint_list_id" nullable= "false" />
<inverse-join-column name= "fk_endpoint_id" nullable= "false" />
<unique-constraint>
<column-name> fk_endpoint_list_id</column-name >
<column-name> fk_endpoint_id</column-name >
</unique-constraint>
</join-table>
<cascade>
<cascade-all />
</cascade>
</many-to-many>
</attributes>
</entity >
<entity class="org.sm.Endpoint">
<table name= "ENDPOINTS"/>
<attributes>
...
</attributes>
</entity >如何为Hibernate指定映射,如果他决定执行
DELETE FROM ENDPOINTS WHERE id = 123在此之前,他必须执行
DELETE FROM ENDPOINT_LIST_TO_ENDPOINTS WHERE fk_endpoint_id = 123发布于 2013-11-16 19:47:24
https://stackoverflow.com/questions/20017256
复制相似问题