- Two entity beans: BeanA and BeanB, in a one to one undirectional relationship with each other - Two references: ba1 and ba2, to instance of BeanA and two references, bb1 and bb2, to instance of Bean2. ba1 is linked to bb1 and ba2 is linked to bb2
give the statement that will make sure that: ba2.getBean2() == null
My answer was: ba2.setBean2(null) However, the correct answer appears to be: ba1.setBean2(ba2.getBean2())
First I was typing the 'correct' answer, but then I was thinking: it has a side effect so I changed it. If you go with the correct answer the requirement ba2.getBean2() is fullfilled, but the ba1 lost its reference to bb1, its now referencing bb2. So my solution does 100% what is asked to be done, while the correct answer does more.
Anyway, why is my answer wrong ? Technically this is correct no ?
The only place where null is not allowed is with CMR that require a collection (you should then pass an empty collection).
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads