Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.grails.orm.hibernate.metaclass
[Java] Class AbstractSavePersistentMethod

    java.lang.Object
      org.codehaus.groovy.grails.commons.metaclass.AbstractDynamicMethodInvocation
          org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractDynamicPersistentMethod
              org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractSavePersistentMethod

    public abstract class AbstractSavePersistentMethod
    extends AbstractDynamicPersistentMethod

Abstract class for different implementations that perform saving to implement.

Authors:
  Graeme Rocher

Since:
  0.3

Field Summary

Fields inherited from class AbstractDynamicPersistentMethod
ERRORS_PROPERTY

Constructor Summary
`AbstractSavePersistentMethod(java.util.regex.Pattern pattern, org.hibernate.SessionFactory sessionFactory, java.lang.ClassLoader classLoader, GrailsApplication application, GrailsDomainClass domainClass, HibernateDatastore datastore)`
`AbstractSavePersistentMethod(java.util.regex.Pattern pattern, org.hibernate.SessionFactory sessionFactory, java.lang.ClassLoader classLoader, GrailsApplication application, HibernateDatastore datastore)`

Method Summary
`static void` | `clearDisabledValidations(java.lang.Object obj)`
`static void` | `clearDisabledValidations()`
`protected java.lang.Object` | `doInvokeInternal(java.lang.Object target, java.lang.Object[] arguments)`
`protected java.lang.Object` | `handleValidationError(GrailsDomainClass domainClass, java.lang.Object target, org.springframework.validation.Errors errors)` Sets the flush mode to manual. which ensures that the database changes are not persisted to the database if a validation error occurs.
`static boolean` | `isAutoValidationDisabled(java.lang.Object obj)`
`protected java.lang.Object` | `performInsert(java.lang.Object target, boolean shouldFlush)`
`protected java.lang.Object` | `performSave(java.lang.Object target, boolean shouldFlush)` Subclasses should override and perform a save operation, flushing the session if the second argument is true
`protected void` | `setErrorsOnInstance(java.lang.Object target, org.springframework.validation.Errors errors)` Associates the Errors object on the instance

Methods inherited from class AbstractDynamicPersistentMethod
doInvokeInternal, getHibernateTemplate, invoke, setObjectToReadOnly, setObjectToReadWrite, setupErrorsProperty

Methods inherited from class AbstractDynamicMethodInvocation
getPattern, invoke, isMethodMatch, setPattern

Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### AbstractSavePersistentMethod

    public AbstractSavePersistentMethod(java.util.regex.Pattern pattern, org.hibernate.SessionFactory sessionFactory, java.lang.ClassLoader classLoader, GrailsApplication application, @SuppressWarnings("unused") GrailsDomainClass domainClass, HibernateDatastore datastore)

### AbstractSavePersistentMethod

    public AbstractSavePersistentMethod(java.util.regex.Pattern pattern, org.hibernate.SessionFactory sessionFactory, java.lang.ClassLoader classLoader, GrailsApplication application, HibernateDatastore datastore)

Method Detail

### clearDisabledValidations

    public static void clearDisabledValidations(java.lang.Object obj)

### clearDisabledValidations

    public static void clearDisabledValidations()

### doInvokeInternal

    @SuppressWarnings("rawtypes")
    @Override
    protected java.lang.Object doInvokeInternal(java.lang.Object target, java.lang.Object[] arguments)

### handleValidationError

    protected java.lang.Object handleValidationError(GrailsDomainClass domainClass, java.lang.Object target, org.springframework.validation.Errors errors)

  Sets the flush mode to manual. which ensures that the database changes are not persisted to the database if a validation error occurs. If save() is called again and validation passes the code will check if there is a manual flush mode and flush manually if necessary
  Parameters:
    `domainClass` - The domain class
    `target` - The target object that failed validation
    `errors` - The Errors instance
  Returns:
    This method will return null signaling a validation failure

### isAutoValidationDisabled

    public static boolean isAutoValidationDisabled(java.lang.Object obj)

### performInsert

    protected java.lang.Object performInsert(java.lang.Object target, boolean shouldFlush)

### performSave

    protected java.lang.Object performSave(java.lang.Object target, boolean shouldFlush)

  Subclasses should override and perform a save operation, flushing the session if the second argument is true
  Parameters:
    `target` - The target object to save
    `shouldFlush` - Whether to flush
  Returns:
    The target object

### setErrorsOnInstance

    protected void setErrorsOnInstance(java.lang.Object target, org.springframework.validation.Errors errors)

  Associates the Errors object on the instance
  Parameters:
    `target` - The target instance
    `errors` - The Errors object

Groovy Documentation