ItemTag objects contain an Item object and a Tag object. (These are Java domain objects.)
This simple query works as expected. I get back a list ItemTags and can do all the wonderful things that ItemTags are supposed to do:
def theTags1 = ItemTag.findAll("from ItemTag b")
For example:
println(theTags1[0].tag.tag)
gives me this as expected:
Pilgrim's Progress
However, as soon as I add another table to the criteria, instead of getting a list of ItemTags, I just get a list of generic objects.
e.g the following
def theTags2 = ItemTag.findAll("from ItemTag b, Tag a where b.tag= a")
theTags2.each {
theClass = it.getClass();
nameOfClass = theClass.getName();
println(nameOfClass)
}
returns
[Ljava.lang.Object;
[Ljava.lang.Object;
[Ljava.lang.Object;
And I can't use the resulting objects at all. For example:
println(theTags2[0].tag.tag)
gives me this error:
Exception evaluating property 'tag' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: tag for class: java.lang.String
and
def exTag2 = (ItemTag) theTags2[0]
gives me this error:
Cannot cast object '[Ljava.lang.Object;@2d81f' with class '[Ljava.lang.Object;' to class 'org.maflt.flashlit.pojo.ItemTag'
What do I need to do to get usable objects? Thanks!