Class MappingRepository

    • Constructor Detail

      • MappingRepository

        public MappingRepository()
        Default constructor. Configure via Configurable.
    • Method Detail

      • getDBDictionary

        public DBDictionary getDBDictionary()
        Convenient access to dictionary for mappings.
      • getMappingDefaults

        public MappingDefaults getMappingDefaults()
        Mapping defaults.
      • setMappingDefaults

        public void setMappingDefaults​(MappingDefaults defaults)
        Mapping default.
      • getSchemaGroup

        public SchemaGroup getSchemaGroup()
        Representation of the database schema.
      • setSchemaGroup

        public void setSchemaGroup​(SchemaGroup schema)
        Representation of the database schema.
      • getStrategyInstaller

        public StrategyInstaller getStrategyInstaller()
        Installs mapping strategies on components.
      • setStrategyInstaller

        public void setStrategyInstaller​(StrategyInstaller installer)
        Installs mapping strategies on components.
      • getQueryResultMapping

        public QueryResultMapping getQueryResultMapping​(java.lang.Class<?> cls,
                                                        java.lang.String name,
                                                        java.lang.ClassLoader loader,
                                                        boolean mustExist)
        Return the query result mapping for the given name.
      • getQueryResultMappings

        public QueryResultMapping[] getQueryResultMappings()
        Return all cached query result mappings.
      • getCachedQueryResultMapping

        public QueryResultMapping getCachedQueryResultMapping​(java.lang.Class cls,
                                                              java.lang.String name)
        Return the cached query result mapping with the given name, or null if none.
      • addQueryResultMapping

        public QueryResultMapping addQueryResultMapping​(java.lang.Class cls,
                                                        java.lang.String name)
        Add a query result mapping.
      • removeQueryResultMapping

        public boolean removeQueryResultMapping​(QueryResultMapping res)
        Remove a query result mapping.
      • removeQueryResultMapping

        public boolean removeQueryResultMapping​(java.lang.Class cls,
                                                java.lang.String name)
        Remove a query result mapping.
      • getMapping

        public ClassMapping getMapping​(java.lang.Class<?> cls,
                                       java.lang.ClassLoader envLoader,
                                       boolean mustExist)
      • getMapping

        public ClassMapping getMapping​(java.lang.Object oid,
                                       java.lang.ClassLoader envLoader,
                                       boolean mustExist)
      • getImplementorMappings

        public ClassMapping[] getImplementorMappings​(java.lang.Class<?> cls,
                                                     java.lang.ClassLoader envLoader,
                                                     boolean mustExist)
      • newVersion

        protected Version newVersion​(ClassMapping cls)
        Create version metadata for the given class.
      • newDiscriminator

        protected Discriminator newDiscriminator​(ClassMapping cls)
        Create discriminator metadata for the given class.
      • newMappingInfo

        protected VersionMappingInfo newMappingInfo​(Version version)
        Create raw mapping info for the given instance.
      • namedStrategy

        protected ClassStrategy namedStrategy​(ClassMapping cls)
        Instantiate the given class' named strategy, or return null if no named strategy.
      • instantiateClassStrategy

        protected ClassStrategy instantiateClassStrategy​(java.lang.String name,
                                                         ClassMapping cls)
        Return the strategy for the given name.
      • namedStrategy

        protected FieldStrategy namedStrategy​(FieldMapping field,
                                              boolean installHandlers)
        Instantiate the given field's named strategy, or return null if no named strategy.
      • namedStrategy

        protected DiscriminatorStrategy namedStrategy​(Discriminator discrim)
        Instantiate the given discriminator's named strategy, or return null if no named strategy.
      • instantiateDiscriminatorStrategy

        protected DiscriminatorStrategy instantiateDiscriminatorStrategy​(java.lang.String name,
                                                                         Discriminator discrim)
        Instantiate the given discriminator strategy.
      • namedStrategy

        protected VersionStrategy namedStrategy​(Version version)
        Instantiate the given version's named strategy, or return null if no named strategy.
      • instantiateVersionStrategy

        protected VersionStrategy instantiateVersionStrategy​(java.lang.String name,
                                                             Version version)
        Instantiate the given version strategy.
      • instantiateVersionStrategy

        protected VersionStrategy instantiateVersionStrategy​(java.lang.Class<?> strat,
                                                             Version version,
                                                             java.lang.String props)
        Instantiate the given version strategy.
      • defaultStrategy

        protected ClassStrategy defaultStrategy​(ClassMapping cls)
        Determine the default strategy to use for the given class. Does not take into account the current strategy, if any.
      • defaultStrategy

        protected ClassStrategy defaultStrategy​(ClassMapping cls,
                                                boolean adapting)
        Determine the default strategy to use for the given class. Does not take into account the current strategy, if any.
      • defaultStrategy

        protected FieldStrategy defaultStrategy​(FieldMapping field,
                                                boolean installHandlers)
        Determine the default strategy to use for the given field. Does not take into account the named or current strategy, if any. If a non-null strategy is returned, this method may as a side effect install value handlers on the field's value mappings.
      • defaultStrategy

        protected FieldStrategy defaultStrategy​(FieldMapping field,
                                                boolean installHandlers,
                                                boolean adapting)
        Determine the default strategy to use for the given field. Does not take into account the named or current strategy, if any. If a non-null strategy is returned, this method may as a side effect install value handlers on the field's value mappings.
      • defaultTypeStrategy

        protected FieldStrategy defaultTypeStrategy​(FieldMapping field,
                                                    boolean installHandlers,
                                                    boolean adapting)
        Return the built-in strategy for the field's type, or null if none.
      • handlerCollectionStrategy

        protected FieldStrategy handlerCollectionStrategy​(FieldMapping field,
                                                          ValueHandler ehandler,
                                                          boolean installHandlers)
        Return the collection strategy for the given element handler, or null if none.
      • handlerMapStrategy

        protected FieldStrategy handlerMapStrategy​(FieldMapping field,
                                                   ValueHandler khandler,
                                                   ValueHandler vhandler,
                                                   boolean krel,
                                                   boolean vrel,
                                                   boolean installHandlers)
        Return the map strategy for the given key and value handlers / relations, or null if none.
      • isNonDefaultMappingAllowed

        public boolean isNonDefaultMappingAllowed()
      • isUniMTo1JT

        public boolean isUniMTo1JT​(FieldMapping field)
      • isUni1To1JT

        public boolean isUni1To1JT​(FieldMapping field)
      • isBi1To1JT

        public boolean isBi1To1JT​(FieldMapping field)
      • isUni1ToMFK

        public boolean isUni1ToMFK​(FieldMapping field)
      • isBiMTo1JT

        public boolean isBiMTo1JT​(FieldMapping field)
      • hasJoinColumn

        public boolean hasJoinColumn​(FieldMapping field)
      • hasJoinTable

        public boolean hasJoinTable​(FieldMapping field)
      • isBidirectional

        public boolean isBidirectional​(FieldMapping field)
      • namedHandler

        protected ValueHandler namedHandler​(ValueMapping val)
        Instantiate the given value's named handler, or return null if no named handler.
      • defaultHandler

        protected ValueHandler defaultHandler​(ValueMapping val)
        Determine the default handler to use for the given value. Does not take into account the named handler, if any.
      • defaultHandler

        protected ValueHandler defaultHandler​(ValueMapping val,
                                              boolean adapting)
        Determine the default handler to use for the given value. Does not take into account the named handler, if any.
      • defaultStrategy

        protected DiscriminatorStrategy defaultStrategy​(Discriminator discrim)
        Determine the default strategy to use for the given discriminator. Does not take into account the current strategy, if any.
      • defaultStrategy

        protected DiscriminatorStrategy defaultStrategy​(Discriminator discrim,
                                                        boolean adapting)
        Determine the default strategy to use for the given discriminator. Does not take into account the current strategy, if any.
      • defaultStrategy

        protected VersionStrategy defaultStrategy​(Version version)
        Determine the default strategy to use for the given version. Does not take into account the current strategy, if any.
      • defaultStrategy

        protected VersionStrategy defaultStrategy​(Version version,
                                                  boolean adapting)
        Determine the default strategy to use for the given version. Does not take into account the current strategy, if any.
      • findBaseClassMapping

        protected ClassMapping findBaseClassMapping​(ClassMapping mapping)
        Finds the base class mapping for the specified mapping. Loads all persistent types if necessary, since all persistent subclasses of this mapping may not have been resolved before this method is called.
      • setDefaultInheritanceStrategy

        protected void setDefaultInheritanceStrategy​(ClassMapping mapping)
        If an inheritance strategy has not been set on this mapping, set it to the default (flat). This method should be called before strategies are created for the specified mapping.
      • hasInheritanceStrategy

        protected boolean hasInheritanceStrategy​(ClassMapping mapping)
        Determines whether an inhertance strategy has been set on the specified mapping.