This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Ok, this is probably going to make people ask why the database is setup this way. To make a long story short, I don't have control of the database schema
I have two objects
objA and objB
objA will contain user input, one of which will be a selected instance of objB
Instances of objB are loaded during application startup and displayed to the user for them to select
An instance of objA will\must contain at least one instance of objB
So I have two tables
A and B
A will contain the user input and will refer to a row of B
B contains lookup values that I can not delete
A and B are joined via A_B
Now I've managed to create a mapping that allows me to insert objA into table A, and A_B will contain a references to rows in B. However, when I delete objA it's trying to delete rows from B as well. Unfortunately this will never work since B is used by many tables, and even if it wasn't it's a lookup value that I don't ever want removed. So the constraint violations I'm getting are to be expected. What I need to do is delete from A and from A_B but not from B.
Just to complicate matters objC will contain a set of objA
Here's my current mapping