Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.orm.hibernate.cfg
Class GrailsDomainBinder

    java.lang.Object
      org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder

    public final class GrailsDomainBinder

extends Object

Handles the binding Grails domain classes and properties to the Hibernate runtime meta model. Based on the HbmBinder code in Hibernate core and influenced by AnnotationsBinder.

Since:
  0.1

  Created: 06-Jul-2005
Author:
  Graeme Rocher

Nested Class Summary
`(package private) static class` | `GrailsDomainBinder.CollectionType` A Collection type, for the moment only Set is supported
`(package private) static class` | `GrailsDomainBinder.GrailsCollectionSecondPass` Second pass class for grails relationships.
`(package private) static class` | `GrailsDomainBinder.ListSecondPass`
`(package private) static class` | `GrailsDomainBinder.MapSecondPass`

Constructor Summary
`GrailsDomainBinder()`

Method Summary
`static void` | `bindClass(GrailsDomainClass domainClass, org.hibernate.cfg.Mappings mappings)` Binds a Grails domain class to the Hibernate runtime meta model
`protected static void` | `bindNumericColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)` Interrogates the specified constraints looking for any constraints that would limit the precision and/or scale of the property's value.
`static void` | `bindRoot(GrailsDomainClass domainClass, org.hibernate.cfg.Mappings mappings)` Binds a root class (one with no super classes) to the runtime meta model based on the supplied Grails domain class
`protected static void` | `bindStringColumnConstraints(org.hibernate.mapping.Column column, ConstrainedProperty constrainedProperty)` Interrogates the specified constraints looking for any constraints that would limit the length of the property's value.
`protected static void` | `createClassProperties(GrailsDomainClass domainClass, org.hibernate.mapping.PersistentClass persistentClass, org.hibernate.cfg.Mappings mappings)` Creates and binds the properties for the specified Grails domain class and PersistantClass and binds them to the Hibernate runtime meta model
`static Mapping` | `evaluateMapping(GrailsDomainClass domainClass)` Evaluates a Mapping object from the domain class if it has a mapping closure
`static Mapping` | `evaluateMapping(GrailsDomainClass domainClass, groovy.lang.Closure defaultMapping)`
`static Mapping` | `getMapping(Class theClass)` Obtains a mapping object for the given domain class nam
`static Mapping` | `getMapping(GrailsDomainClass domainClass)` Obtains a mapping object for the given domain class nam

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GrailsDomainBinder

    public GrailsDomainBinder()

Method Detail

### bindClass

    public static void bindClass(GrailsDomainClass domainClass,
                                 org.hibernate.cfg.Mappings mappings)
                          throws org.hibernate.MappingException

  Binds a Grails domain class to the Hibernate runtime meta model

  Parameters:
    `domainClass` - The domain class to bind
    `mappings` - The existing mappings
  Throws:
    `org.hibernate.MappingException` - Thrown if the domain class uses inheritance which is not supported

### evaluateMapping

    public static Mapping evaluateMapping(GrailsDomainClass domainClass)

  Evaluates a Mapping object from the domain class if it has a mapping closure

  Parameters:
    `domainClass` - The domain class

### evaluateMapping

    public static Mapping evaluateMapping(GrailsDomainClass domainClass,
                                          groovy.lang.Closure defaultMapping)

### getMapping

    public static Mapping getMapping(Class theClass)

  Obtains a mapping object for the given domain class nam

  Parameters:
    `theClass` - The domain class in question
  Returns:
    A Mapping object or null

### getMapping

    public static Mapping getMapping(GrailsDomainClass domainClass)

  Obtains a mapping object for the given domain class nam

  Parameters:
    `domainClass` - The domain class in question
  Returns:
    A Mapping object or null

### bindRoot

    public static void bindRoot(GrailsDomainClass domainClass,
                                org.hibernate.cfg.Mappings mappings)

  Binds a root class (one with no super classes) to the runtime meta model based on the supplied Grails domain class

  Parameters:
    `domainClass` - The Grails domain class
    `mappings` - The Hibernate Mappings object

### createClassProperties

    protected static void createClassProperties(GrailsDomainClass domainClass,
                                                org.hibernate.mapping.PersistentClass persistentClass,
                                                org.hibernate.cfg.Mappings mappings)

  Creates and binds the properties for the specified Grails domain class and PersistantClass and binds them to the Hibernate runtime meta model

  Parameters:
    `domainClass` - The Grails domain class
    `persistentClass` - The Hibernate PersistentClass instance
    `mappings` - The Hibernate Mappings instance

### bindStringColumnConstraints

    protected static void bindStringColumnConstraints(org.hibernate.mapping.Column column,
                                                      ConstrainedProperty constrainedProperty)

  Interrogates the specified constraints looking for any constraints that would limit the length of the property's value. If such constraints exist, this method adjusts the length of the column accordingly.

  Parameters:
    `column` - the column that corresponds to the property
    `constrainedProperty` - the property's constraints

### bindNumericColumnConstraints

    protected static void bindNumericColumnConstraints(org.hibernate.mapping.Column column,
                                                       ConstrainedProperty constrainedProperty)

  Interrogates the specified constraints looking for any constraints that would limit the precision and/or scale of the property's value. If such constraints exist, this method adjusts the precision and/or scale of the column accordingly.

  Parameters:
    `column` - the column that corresponds to the property
    `constrainedProperty` - the property's constraints

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2005-2009 The Grails project