jigu4paint wrote:
So you mean I required DELETE in case to use DELETE_ORPHAN??
@OneToMany(fetch = FetchType.LAZY)
@Cascade(
{
org.hibernate.annotations.CascadeType.SAVE_UPDATE,
org.hibernate.annotations.CascadeType.DELETE
org.hibernate.annotations.CascadeType.DELETE_ORPHAN
})
@JoinTable(name = "t_per_cars", joinColumns =
{
@JoinColumn(name = "fk_to_person")
})
@IndexColumn(name = "car_list_position", base = 1)
private List<Car> cars = new ArrayList<Car>();
Maybe, I don't know - try.
jigu4paint wrote:
Yes , just like Person and car association and many more..
for example.
public class Car implements Vehichel {
......................
@CollectionOfElements(targetElement = Part.class)
@JoinTable(name = "t_carpats", joinColumns = { @JoinColumn(name = "car_id", nullable=false) })
@MapKey(columns = @Column(name="part_id", nullable=false))
@Column(name = "partname")
public Map<String, Part> part = new HashMap<String,Part>();
// Many other association
...............
}
... and possibly one of these collections prevents car from being deleted. Does not look like you have a cascading delete down to the
part collection. Since that one joins on the
car_id column, not to be nullable, deletion of cars does not work.
CU
Froestel
btw: Please use BBCode - see buttons below the subject field - makes your posts much easier to read if used properly.