开发者

Grooovy weird error

开发者 https://www.devze.com 2023-03-08 03:43 出处:网络
class Area { String name String description static constraints = { } _ class SearchIndexing { String search
 class Area {

        String name
        String description

        static constraints = {
        }

_

 class SearchIndexing {

        String search
        Area area

        static constraints = {
        }
    }  
开发者_开发问答

_

 <%

            def area = cm.Area.get(1)

            def si = new cm.SearchIndexing()

            def concat   

            concat = area.name // i wanna join here more things with much bigger class

            si.search = concat
            si.area = area
            si.save()

            out << searchIndexing.list()

            %>

ERROR:

No signature of method: cm.SearchIndexing.save() is applicable for argument types: () values: [] Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), isCase(java.lang.Object), use([Ljava.lang.Object;) 


Sure you don't have an initial + sign, ie:

def temp = + obj2.prop1 + " " + ...

Why not try a more groovy way like:

def temp = "$obj2.prop1 $obj2.prop2 ..."

Or:

def temp = [ obj2.prop1, obj2.prop2 ].join( ' ' )


From the way you're creating the instance of SearchIndexing

def si = new cm.SearchIndexing()

it looks like it's an inner class. I don't think a domain class can be an inner class, which would explain why it has no save() method.

0

精彩评论

暂无评论...
验证码 换一张
取 消