org.hibernate.cfg

Class HbmBinder


public final class HbmBinder
extends java.lang.Object

Walks an XML mapping document and produces the Hibernate configuration-time metamodel (the classes in the mapping package)
Author:
Gavin King

Method Summary

static void
bindAny(Element node, Any any, boolean isNullable, Mappings mappings)
static void
bindArray(Element node, Array array, String prefix, String path, Mappings mappings, java.util.Map inheritedMetas)
Called for arrays and primitive arrays
static void
bindClass(Element node, PersistentClass persistentClass, Mappings mappings, java.util.Map inheritedMetas)
static void
bindCollection(Element node, Collection collection, String className, String path, Mappings mappings, java.util.Map inheritedMetas)
Called for all collections
static void
bindCollectionSecondPass(Element node, Collection collection, java.util.Map persistentClasses, Mappings mappings, java.util.Map inheritedMetas)
Called for all collections
static void
bindColumn(Element node, Column column, boolean isNullable)
static void
bindColumns(Element node, SimpleValue simpleValue, boolean isNullable, boolean autoColumn, String propertyPath, Mappings mappings)
static void
bindComponent(Element node, Component component, String ownerClassName, String parentProperty, String path, boolean isNullable, boolean isEmbedded, Mappings mappings, java.util.Map inheritedMetas, boolean isIdentifierMapper)
static void
bindComposite(Element node, Component component, String path, boolean isNullable, Mappings mappings, java.util.Map inheritedMetas)
static void
bindCompositeId(Element node, Component component, PersistentClass persistentClass, String propertyName, Mappings mappings, java.util.Map inheritedMetas)
static void
bindIdentifierCollectionSecondPass(Element node, IdentifierCollection collection, java.util.Map persistentClasses, Mappings mappings, java.util.Map inheritedMetas)
static void
bindJoinedSubclass(Element node, JoinedSubclass joinedSubclass, Mappings mappings, java.util.Map inheritedMetas)
static void
bindListSecondPass(Element node, List list, java.util.Map classes, Mappings mappings, java.util.Map inheritedMetas)
Called for Lists, arrays, primitive arrays
static void
bindManyToOne(Element node, ManyToOne manyToOne, String path, boolean isNullable, Mappings mappings)
static void
bindMapSecondPass(Element node, Map map, java.util.Map classes, Mappings mappings, java.util.Map inheritedMetas)
Called for Maps
static void
bindOneToMany(Element node, OneToMany oneToMany, Mappings mappings)
static void
bindOneToOne(Element node, OneToOne oneToOne, String path, boolean isNullable, Mappings mappings)
static void
bindProperty(Element node, Property property, Mappings mappings, java.util.Map inheritedMetas)
static void
bindRoot(Document doc, Mappings mappings, java.util.Map inheritedMetas)
The main contract into the hbm.xml-based binder.
static void
bindRootClass(Element node, RootClass rootClass, Mappings mappings, java.util.Map inheritedMetas)
Responsible for perfoming the bind operation related to an <class/> mapping element.
static void
bindSimpleValue(Element node, SimpleValue simpleValue, boolean isNullable, String path, Mappings mappings)
static void
bindSubclass(Element node, Subclass subclass, Mappings mappings, java.util.Map inheritedMetas)
static void
bindUnionSubclass(Element node, UnionSubclass unionSubclass, Mappings mappings, java.util.Map inheritedMetas)
protected static void
createClassProperties(Element node, PersistentClass persistentClass, Mappings mappings, java.util.Map inheritedMetas)
protected static void
createClassProperties(Element node, PersistentClass persistentClass, Mappings mappings, java.util.Map inheritedMetas, UniqueKey uniqueKey, boolean mutable, boolean nullable, boolean naturalId)
static CacheMode
getCacheMode(String cacheMode)
static String
getClassName(String unqualifiedName, String defaultPackage)
static String
getClassName(String unqualifiedName, Mappings model)
static String
getEntityName(Element elem, Mappings model)
static java.util.List
getExtendsNeeded(Document doc, Mappings mappings)
For the given document, locate all extends attributes which refer to entities (entity-name or class-name) not defined within said document.
static FlushMode
getFlushMode(String flushMode)
static java.util.Map
getMetas(Element node, java.util.Map inheritedMeta, boolean onlyInheritable)
static java.util.Map
getParameterTypes(Element queryElem)
static String
getTypeFromXML(Element node)

Method Details

bindAny

public static void bindAny(Element node,
                           Any any,
                           boolean isNullable,
                           Mappings mappings)
            throws MappingException

bindArray

public static void bindArray(Element node,
                             Array array,
                             String prefix,
                             String path,
                             Mappings mappings,
                             java.util.Map inheritedMetas)
            throws MappingException
Called for arrays and primitive arrays

bindClass

public static void bindClass(Element node,
                             PersistentClass persistentClass,
                             Mappings mappings,
                             java.util.Map inheritedMetas)
            throws MappingException

bindCollection

public static void bindCollection(Element node,
                                  Collection collection,
                                  String className,
                                  String path,
                                  Mappings mappings,
                                  java.util.Map inheritedMetas)
            throws MappingException
Called for all collections

bindCollectionSecondPass

public static void bindCollectionSecondPass(Element node,
                                            Collection collection,
                                            java.util.Map persistentClasses,
                                            Mappings mappings,
                                            java.util.Map inheritedMetas)
            throws MappingException
Called for all collections

bindColumn

public static void bindColumn(Element node,
                              Column column,
                              boolean isNullable)

bindColumns

public static void bindColumns(Element node,
                               SimpleValue simpleValue,
                               boolean isNullable,
                               boolean autoColumn,
                               String propertyPath,
                               Mappings mappings)
            throws MappingException

bindComponent

public static void bindComponent(Element node,
                                 Component component,
                                 String ownerClassName,
                                 String parentProperty,
                                 String path,
                                 boolean isNullable,
                                 boolean isEmbedded,
                                 Mappings mappings,
                                 java.util.Map inheritedMetas,
                                 boolean isIdentifierMapper)
            throws MappingException

bindComposite

public static void bindComposite(Element node,
                                 Component component,
                                 String path,
                                 boolean isNullable,
                                 Mappings mappings,
                                 java.util.Map inheritedMetas)
            throws MappingException

bindCompositeId

public static void bindCompositeId(Element node,
                                   Component component,
                                   PersistentClass persistentClass,
                                   String propertyName,
                                   Mappings mappings,
                                   java.util.Map inheritedMetas)
            throws MappingException

bindIdentifierCollectionSecondPass

public static void bindIdentifierCollectionSecondPass(Element node,
                                                      IdentifierCollection collection,
                                                      java.util.Map persistentClasses,
                                                      Mappings mappings,
                                                      java.util.Map inheritedMetas)
            throws MappingException

bindJoinedSubclass

public static void bindJoinedSubclass(Element node,
                                      JoinedSubclass joinedSubclass,
                                      Mappings mappings,
                                      java.util.Map inheritedMetas)
            throws MappingException

bindListSecondPass

public static void bindListSecondPass(Element node,
                                      List list,
                                      java.util.Map classes,
                                      Mappings mappings,
                                      java.util.Map inheritedMetas)
            throws MappingException
Called for Lists, arrays, primitive arrays

bindManyToOne

public static void bindManyToOne(Element node,
                                 ManyToOne manyToOne,
                                 String path,
                                 boolean isNullable,
                                 Mappings mappings)
            throws MappingException

bindMapSecondPass

public static void bindMapSecondPass(Element node,
                                     Map map,
                                     java.util.Map classes,
                                     Mappings mappings,
                                     java.util.Map inheritedMetas)
            throws MappingException
Called for Maps

bindOneToMany

public static void bindOneToMany(Element node,
                                 OneToMany oneToMany,
                                 Mappings mappings)
            throws MappingException

bindOneToOne

public static void bindOneToOne(Element node,
                                OneToOne oneToOne,
                                String path,
                                boolean isNullable,
                                Mappings mappings)
            throws MappingException

bindProperty

public static void bindProperty(Element node,
                                Property property,
                                Mappings mappings,
                                java.util.Map inheritedMetas)
            throws MappingException

bindRoot

public static void bindRoot(Document doc,
                            Mappings mappings,
                            java.util.Map inheritedMetas)
            throws MappingException
The main contract into the hbm.xml-based binder. Performs necessary binding operations represented by the given DOM.
Parameters:
doc - The DOM to be parsed and bound.
mappings - Current bind state.
inheritedMetas - Any inherited meta-tag information.

bindRootClass

public static void bindRootClass(Element node,
                                 RootClass rootClass,
                                 Mappings mappings,
                                 java.util.Map inheritedMetas)
            throws MappingException
Responsible for perfoming the bind operation related to an <class/> mapping element.
Parameters:
node - The DOM Element for the <class/> element.
rootClass - The mapping instance to which to bind the information.
mappings - The current bind state.
inheritedMetas - Any inherited meta-tag information.

bindSimpleValue

public static void bindSimpleValue(Element node,
                                   SimpleValue simpleValue,
                                   boolean isNullable,
                                   String path,
                                   Mappings mappings)
            throws MappingException

bindSubclass

public static void bindSubclass(Element node,
                                Subclass subclass,
                                Mappings mappings,
                                java.util.Map inheritedMetas)
            throws MappingException

bindUnionSubclass

public static void bindUnionSubclass(Element node,
                                     UnionSubclass unionSubclass,
                                     Mappings mappings,
                                     java.util.Map inheritedMetas)
            throws MappingException

createClassProperties

protected static void createClassProperties(Element node,
                                            PersistentClass persistentClass,
                                            Mappings mappings,
                                            java.util.Map inheritedMetas)
            throws MappingException

createClassProperties

protected static void createClassProperties(Element node,
                                            PersistentClass persistentClass,
                                            Mappings mappings,
                                            java.util.Map inheritedMetas,
                                            UniqueKey uniqueKey,
                                            boolean mutable,
                                            boolean nullable,
                                            boolean naturalId)
            throws MappingException

getCacheMode

public static CacheMode getCacheMode(String cacheMode)

getClassName

public static String getClassName(String unqualifiedName,
                                  String defaultPackage)

getClassName

public static String getClassName(String unqualifiedName,
                                  Mappings model)

getEntityName

public static String getEntityName(Element elem,
                                   Mappings model)

getExtendsNeeded

public static java.util.List getExtendsNeeded(Document doc,
                                              Mappings mappings)
For the given document, locate all extends attributes which refer to entities (entity-name or class-name) not defined within said document.
Parameters:
doc - The document to check
mappings - The already processed mappings.
Returns:
The list of unresolved extends names.

getFlushMode

public static final FlushMode getFlushMode(String flushMode)

getMetas

public static final java.util.Map getMetas(Element node,
                                           java.util.Map inheritedMeta,
                                           boolean onlyInheritable)

getParameterTypes

public static java.util.Map getParameterTypes(Element queryElem)

getTypeFromXML

public static String getTypeFromXML(Element node)
            throws MappingException