1
나는 다음과 같은 기관의지도를 포함하는 개체를 삭제하려고으로 지속지도의 요소를 삭제하는 방법 : 난 항상 StatCategory 테이블에 categories_id에 대해 불평 제약 조건 위반 오류가 발생하지만JPA
@Entity
public class TrxReport extends Model {
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "StatCategory")
@MapKeyColumn(name = "TrxReport_key", nullable = false)
@Cascade(value = { CascadeType.ALL })
public Map<String, TrxStatCategory> categories;
@Override
public TrxReport delete(){
for (AtmPosTrxStatCategory cat : categories.values()) {
if (cat != null){
categories.remove(cat.name);
cat.delete();
}
}
super.delete();
return this;
}
}
. 삭제가 사용자 지정 쿼리로 수행되어야합니까? 아니면 위와 유사하게 수행 할 수 있습니까?
나는 개체의지도를 이용하여 지속 할 수 있다고 생각하지 않습니다 했나 @OneToMany 주석 – emt14
당신이 [@MapKey] (http로를 사용하여 시도 유무 : //docs.oracle.com/javaee/6/api/javax/persistence/MapKey.html)? – maartencls
일대 다 (one-to-many)로 만들 수 없습니까? 그러면지도를 읽기 전용으로하는 별도의 속성을 가질 수 있습니까? – Zoidberg