Hi,
I've two Entities, Item and Rack ... a Rack can have multiple Items, so I added a Collection to Rack:
Code:
public class Rack{
@OneToMany(mappedBy="id")
Collection<Item> items = new ArrayList<Item>();
}
However even that seems to generate constraints, and a simple insert into item isn't possible anymore:
Code:
INSERT INTO item VALUES(12, 'Hallo', 'Name', 10);
ERROR: insert or update on table "item" violates foreign key constraint "fk2273135ddcd445"
DETAIL: Key (id)=(12) is not present in table "rack".
Any idea whats the reason behind this?
(Note that I don't do manual SQL inserts, I've done it here, to get a cleaner error-msg)
Another problem I experience is that Item has an associated Placement entity:
Code:
// @OneToOne
// @JoinColumn(name="PLACEMENT_ID")
// Placement placement;
However when placement=NULL because there has non been assigned so far, I also get an constraint voilation error.
Sorry for those noob-questions :/
Thanks, Clemens