[SalesForce] Junction object in Salesforce

What kind of relation should a junction object have with it's parent objects?

What I know from Salesforce documentation:
The junction object should have master-detail relationships with the parent objects.

When I check the pricebookentry relationship with product and pricebook, I see this:

enter image description here

Both Product and Price Book are lookups in pricebookentry and pricebookentry is a junction object.

So, doesn't it contradict with the definition of junction object?

I'm confused. Am I missing something? Can I create a junction object using lookups too?

Best Answer

I disagree with the "common knowledge" on this issue. I have run into use-cases where using a Lookup relationship instead is appropriate. The junction object is a more flexible concept than people give it credit for. I agree that the following are preferable:

  • Junction should only relate to two objects
  • Junction should never be orphan

However, these requirements are not terribly difficult to satisfy without the use of Master-Detail relationships. For example a Validation Rule can count all the lookups and make sure you have exactly two.

A Concrete Example

Let's say you want to mimic polymorphism in your junction. Consider, for example, if I have one object that I want to relate to five others via many-to-many relationship. Do I create five separate true junctions or one junction-like object? There are valid arguments for each side, but to flat out reject the mock polymorphism because it uses Lookup instead of Master-Detail may not be an option in all orgs (sometimes you are limited to ten custom objects).