Currently I'm using a one-to-one association because the company is not really important in the application.
There should just be the possibility to store for every person the information for which he/she works for. The information that two different persons work for the same company is not needed.
But you are right, perhaps it is better to do it as an many-to-one association, I will think about it...
But the problem is not solved because like the company the person have a one-to-one Association to it's BankAccount. I think that is an one-to-one association?!
if I don't want to delete the whole person with session.delete(person) an my person got a BankAccount with
BankAccount account = new BankAccount();
account.setName("Blah")
person.setBankAccount(account)
If I now want to delete the bank account, what is to do?
Do I need something like a ServiceClass which does that for me? That would not be so nice because for other person things like emailaddresses, phonenumbers,... which are in one-to-many associations I do not need a ServiceClass because of
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
I just have to remove it from the collection and update the person...
|