// get a list which contains Book instances with ids 2, 1, 3 respectively
def bookList = Book.getAll(2, 1, 3)
// can take a list of ids as only argument, very
// useful when the ids list is calculated in code
def bookList = Book.getAll([1, 2, 3])
// when called without arguments returns list of all objects
def bookList = Book.getAll()
getAll
用途
擷取指定 id 的網域類別執行個體的 List
,依原始 id 清單排序。如果提供的一些 id 為 null
或沒有這些 id 的執行個體,產生的 List
在那些位置會有 null
值。
範例
說明
參數
-
varargs
* - id 的可變引數清單 -
ids
* - id 的清單