Groovy Documentation

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

java.lang.Object
  org.codehaus.groovy.grails.commons.metaclass.AbstractStaticMethodInvocation
      org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractStaticPersistentMethod
          org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractClausedStaticPersistentMethod
              org.codehaus.groovy.grails.orm.hibernate.metaclass.FindByPersistentMethod

public class FindByPersistentMethod
extends AbstractClausedStaticPersistentMethod

The "findBy*" static persistent method. This method allows querying for instances of grails domain classes based on their properties. This method returns the first result of the query eg. Account.findByHolder("Joe Blogs"); // Where class "Account" has a property called "holder" Account.findByHolderAndBranch("Joe Blogs", "London" ); // Where class "Account" has a properties called "holder" and "branch"

Authors:
Graeme Rocher
Since:
31-Aug-2005


Field Summary
 
Fields inherited from class AbstractClausedStaticPersistentMethod
application
 
Constructor Summary
FindByPersistentMethod(GrailsApplication application, SessionFactory sessionFactory, java.lang.ClassLoader classLoader)

Constructor.

 
Method Summary
protected java.lang.Object doInvokeInternalWithExpressions(java.lang.Class clazz, java.lang.String methodName, Object[] arguments, java.util.List expressions, java.lang.String operatorInUse, groovy.lang.Closure additionalCriteria)

protected boolean firstExpressionIsRequiredBoolean()

Indicates if the first expression in the query is a required boolean property and as such should be ANDed to the other expressions, not ORed.

 
Methods inherited from class AbstractClausedStaticPersistentMethod
AbstractClausedStaticPersistentMethod, doInvokeInternal, doInvokeInternalWithExpressions
 
Methods inherited from class AbstractStaticPersistentMethod
doInvokeInternal, getCriteria, getHibernateTemplate, invoke, invoke
 
Methods inherited from class AbstractStaticMethodInvocation
getPattern, invoke, isMethodMatch, setPattern, toString
 

Constructor Detail

FindByPersistentMethod

public FindByPersistentMethod(GrailsApplication application, SessionFactory sessionFactory, java.lang.ClassLoader classLoader)
Constructor.
Parameters:
application
sessionFactory
classLoader


 
Method Detail

doInvokeInternalWithExpressions

@SuppressWarnings("rawtypes")
@Override
protected java.lang.Object doInvokeInternalWithExpressions(java.lang.Class clazz, java.lang.String methodName, Object[] arguments, java.util.List expressions, java.lang.String operatorInUse, groovy.lang.Closure additionalCriteria)


firstExpressionIsRequiredBoolean

protected boolean firstExpressionIsRequiredBoolean()
Indicates if the first expression in the query is a required boolean property and as such should be ANDed to the other expressions, not ORed.
Returns:
true if the first expression is a required boolean property, false otherwise
See Also:
FindByBooleanPropertyPersistentMethod


 

Groovy Documentation