I am getting an oracle error when I go to delete an object Dog from the DB, stating that Bark.id cannot be updated to NULL. The DB is set up to perform a cascade
delete on items in the table "Bark" when the Dog item w/ Dog.ID = Bark.ID is deleted, and this functionality is working correctly.
Thoughts? Thank you!
@Entity
@Table(name="DOG")
public class Dog {
Long id;
List<Bark> barks;
@Generated(a sequence..)
@Id
@Column(ID)
public Long getId() {
return this.id;
}
@OneToMany
@JoinColumn(name="id")
public List<Bark> getBarks() {
return this.barks;
}
// setters, etc...
}
@Entity
@Table(name="BARK")
public class Bark {
BarkPk pk;
@Id
public BarkPk getPk() {
return this.pk;
}
// setters, etc..
}
@Embeddable
public class BarkPk implements Serializable {
Long id;
String volume;
// this ID is a FK to the ID in Dog
@Column(name="ID")
public Long getId() {
...
}
@Column(name="VOLUME")
public String getVolume() {
...
}
// setters, etc...
}