org.codehaus.groovy.grails.orm.hibernate.metaclass
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
- All Implemented Interfaces:
- DynamicMethodInvocation
- Direct Known Subclasses:
- MergePersistentMethod, SavePersistentMethod
public abstract class AbstractSavePersistentMethod
- extends AbstractDynamicPersistentMethod
Abstract class for different implementations that perform saving to implement
- Since:
- 0.3
- Author:
- Graeme Rocher
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractSavePersistentMethod
public AbstractSavePersistentMethod(Pattern pattern,
org.hibernate.SessionFactory sessionFactory,
ClassLoader classLoader,
GrailsApplication application)
doInvokeInternal
protected Object doInvokeInternal(Object target,
Object[] arguments)
- Specified by:
doInvokeInternal
in class AbstractDynamicPersistentMethod
handleValidationError
protected Object handleValidationError(Object target,
Errors errors)
- This method willl set the save() method will set the flush mode to manual. What this does
is ensure 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:
target
- The target object that failed validationerrors
- The Errors instance
- Returns:
- This method will return null signaling a validation failure
setErrorsOnInstance
protected void setErrorsOnInstance(Object target,
Errors errors)
- Associates the Errors object on the instance
- Parameters:
target
- The target instanceerrors
- The Errors object
performSave
protected abstract void performSave(Object target,
boolean b)
Copyright (c) 2005-2006 The Grails project