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.metaclass
Class FindPersistentMethod

    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.FindPersistentMethod

All Implemented Interfaces:
  StaticMethodInvocation

    public class FindPersistentMethod

extends AbstractStaticPersistentMethod

The "find" persistent static method allows searching for instances using either an example instance or an HQL query. This method returns the first result of the query. A GrailsQueryException is thrown if the query is not a valid query for the domain class.

Examples in Groovy: `// retrieve the first account ordered by account number def a = Account.find("from Account as a order by a.number asc" ) // with query parameters def a = Account.find("from Account as a where a.number = ? and a.branch = ?", [38479, "London"]) // with query named parameters def a = Account.find("from Account as a where a.number = :number and a.branch = :branch", [number:38479, branch:"London"]) // query by example def a = new Account() a.number = 495749357 def a = Account.find(a)`

Since:
  31-Aug-2005
Author:
  Graeme Rocher, Sergey Nebolsin

Constructor Summary
`FindPersistentMethod(org.hibernate.SessionFactory sessionFactory, ClassLoader classLoader)`

Method Summary
`protected Object` | `doInvokeInternal(Class clazz, String methodName, Object[] arguments)`

Methods inherited from class org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractStaticPersistentMethod
`getHibernateTemplate, 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

### FindPersistentMethod

    public FindPersistentMethod(org.hibernate.SessionFactory sessionFactory,
                                ClassLoader classLoader)

Method Detail

### doInvokeInternal

    protected Object doInvokeInternal(Class clazz,
                                      String methodName,
                                      Object[] arguments)

  Specified by:
    `doInvokeInternal` in class `AbstractStaticPersistentMethod`

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-2006 The Grails project