Hello, I'm having an issue with referencing an entity bean twice from other bean. Here's a simplified version of what I have:
Now, to begin with, is this allowed? If not, how can I achieve something like that? If so, then why am I getting errors while trying to delete objects of type Block? :-). I tried to play around with different cascading settings but nothing seems to help. I'm getting an error:
where the identifier is the key of the block which indeed occurs twice in the Items table, for two different items, but I do not see why should that be a problem.
If there is a need to keep track of Left & Right perhaps these can be subtypes.
posted 10 years ago
Unfortunately, splitting into LeftItem and RightItem would have no business meaning and it would be very confusing. I actually have several such fields, in several "parent" entities, and it could get really complicated really fast.
What I did do is remove the optional=false constraint, and it seems to work correctly now. The only problem is that I have to remember to always set the parent (Block), because the DB will not complain about it missing.