Skip to content

Many to one requirements

gbadner edited this page Jan 30, 2013 · 4 revisions

many-to-one:

  • provided by sources or reflection: referenced entity name
  • required from metadata: referenced entity binding
  • required to resolve domain model: referencedEntityBinding.getEntity()
  • required to resolve relational model:
    • FK source (same as "relational value bindings"):
      • source table: explicitly provided by source; by default, AttributeBindingContainer.getPrimaryTable();
      • column names: provided by source or naming strategy
      • column types, size: can be explicitly provided by source (hbm only?); by default, depends on relational model for FK target columns in referenced entity binding
    • FK target:
      • target table:
        • by default, referencedEntityBinding.getPrimaryTable()
        • hbm: table containing relational values for property-ref
      • column names:
        • by default, ID columns
        • hbm: if property-ref specified, depends on relational model for property-ref in referenced entity binding
        • annotations: provided by source
  • required to create Hibernate type (i.e. ManyToOneType):
    • uniqueKeyPropertyName: JoinColumnResolutionDelegate.getReferencedAttributeName()
      1. uniqueKeyPropertyName can be in a referencedEntityBinding super-EntityBinding
      2. uniqueKeyPropertyName can be a sub-attribute of a CompositeAttributeBinding (e.g., contactInfo.socialSecurityNumber)
      • hbm: provided via property-ref or null
      • annotations: name of attribute binding w/ relational model == JoinColumnResolutionDelegate.getJoinColumns( context ); if not found, then need to wait until relational model for all singular attributes in the referenced entity binding is determined because there may not actually be an attribute using those columns, in which case uniqueKeyPropertyName should be null)