Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
I have question. First, I have two objects A and B that have a one-to-many association from A to B and many-to-one from B to A. Is it appropriate to have a physical Java Object association on only object B. For example B.setA(A) and not have A.getBs().add(B). This is similar to the many-to-one association of Item and Bid. If I wanted to to retrieve all B objects that are related to A (all Bids associated with an Item), I could just write a finder method that scans the B or Bid table looking for the Item foreign key. The plus side to this is that Items are not tightly coupled to Bids. I could use Item in another context unaware of Bids. If a given object, like Item has other one-to-many associations, it seems that it is physically burdened with unnecessary associations. Further it may not be easily reused in other context.
I ask this question because I am working on a project were one object has 2 one-to-many associations. If it were the case that the object needed the associations to be in a valid state (aggregates) then I guess I would think create both associations. To me Item can exist without Bid and therefore it is not mandatory to create the one-to-many association. Any advice or best practice regarding this problem would be greatly appreciated.
Thank you in advance.