org.codehaus.groovy.grails.orm.hibernate.metaclass
Class FindByPersistentMethod

java.lang.Object
  extended by org.codehaus.groovy.grails.commons.metaclass.AbstractStaticMethodInvocation
      extended by org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractStaticPersistentMethod
          extended by org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractClausedStaticPersistentMethod
              extended by org.codehaus.groovy.grails.orm.hibernate.metaclass.FindByPersistentMethod
All Implemented Interfaces:
StaticMethodInvocation
Direct Known Subclasses:
FindByBooleanPropertyPersistentMethod

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"

Since:
31-Aug-2005
Author:
Graeme Rocher

Nested Class Summary
 
Nested classes/interfaces inherited from class org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractClausedStaticPersistentMethod
AbstractClausedStaticPersistentMethod.GrailsMethodExpression
 
Field Summary
 
Fields inherited from class org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractClausedStaticPersistentMethod
application
 
Constructor Summary
FindByPersistentMethod(GrailsApplication application, org.hibernate.SessionFactory sessionFactory, ClassLoader classLoader)
           
 
Method Summary
protected  Object doInvokeInternalWithExpressions(Class clazz, String methodName, Object[] arguments, List expressions, 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 org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractClausedStaticPersistentMethod
doInvokeInternal
 
Methods inherited from class org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractStaticPersistentMethod
getCriteria, getHibernateTemplate, invoke, invoke
 
Methods inherited from class org.codehaus.groovy.grails.commons.metaclass.AbstractStaticMethodInvocation
getPattern, isMethodMatch, setPattern, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FindByPersistentMethod

public FindByPersistentMethod(GrailsApplication application,
                              org.hibernate.SessionFactory sessionFactory,
                              ClassLoader classLoader)
Method Detail

doInvokeInternalWithExpressions

protected Object doInvokeInternalWithExpressions(Class clazz,
                                                 String methodName,
                                                 Object[] arguments,
                                                 List expressions,
                                                 String operatorInUse,
                                                 groovy.lang.Closure additionalCriteria)
Specified by:
doInvokeInternalWithExpressions in class AbstractClausedStaticPersistentMethod

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


Copyright (c) 2005-2009 The Grails project