Is It Possible To Cast A Range
Posted
by Brad Rhoads
on Stack Overflow
See other posts from Stack Overflow
or by Brad Rhoads
Published on 2010-03-18T20:52:38Z
Indexed on
2010/03/19
7:41 UTC
Read the original article
Hit count: 220
grails
I'd like to do something like this:
def results = Item.findAll("from Item c, Tag b, ItemTag a where c = a.item and b = a.tag and (b.tag like :q or c.uri like :q) " + ob,[q:q])
def items = (Item) results[0..1][0]
but I get
Cannot cast object '[Ljava.lang.Object;@1e224a5' with class '[Ljava.lang.Object;' to class 'org.maflt.ibidem.Item'
I can get what I need with this, but it doesn't seem like it's the best solution:
def items = [] as Set
def cnt = results.size()
for (i=0;i<cnt-1;i++) { items << results[i][0] }
items = items as List
© Stack Overflow or respective owner