【发布时间】:2010-09-23 12:23:28
【问题描述】:
我知道 truncate 不被支持,所以我做了一个 Delete from table - 这很好用,但连接表没有这样清理。示例:
Delete from Product;
Delete from Service;
两者都是空的,表service_product仍然被填满。是否有机会在没有原始 sql 的情况下清理我的连接表?
示例实体
public class Service implements Serializable {
private static final long serialVersionUID = 4520872456865907866L;
// seam-gen attributes (you should probably edit these)
@EmbeddedId
private ServiceId id;
@Length(max = 255)
private String servicename;
@Column(columnDefinition = "text")
private String highlightsText;
@Column(columnDefinition = "text")
private String detailsText;
@Column(columnDefinition = "text")
private String productText;
@Column(columnDefinition = "text")
private String dataText;
@ManyToMany(mappedBy = "services")
private Set<Machine> machines;
@OneToMany(targetEntity = ServiceDownload.class, cascade = { CascadeType.ALL }, fetch = FetchType.LAZY)
private List<ServiceDownload> serviceDownloads;
@OneToMany(targetEntity = ProductSpecial.class, cascade = { CascadeType.ALL })
private List<ProductSpecial> productSpecials;
@OneToOne(cascade = { CascadeType.ALL })
private ServicePicture servicePicture;
...
}
【问题讨论】: