1

さて、質問はそれ自体を説明します、これが私がそれをやろうとした方法です。問題は、Setが空であり、それらのメソッドがクラスを返すために少なくとも1つの要素を必要とすることだと思います。

views / product / _form.gsp

<% cl = UnidadProductiva.get(params.unidadProductiva?.id).producto %>
<p>${cl}</p>

戻り値 []

productoの後にこのメソッド/属性を追加した場合:

.getCandidateClass():メソッドのシグネチャなし:
org.hibernate.collection.PersistentSet.getCandidateClass()は引数タイプに適用可能:()値:[]

.class:
クラスorg.hibernate.collection.PersistentSet

.getElementType():メソッドのシグネチャなし:
org.hibernate.collection.PersistentSet.getElementType()は引数タイプに適用可能:()値:[]可能な解決策:getElement(java.lang.Object)

。プロパティ :

{
    clearQueueEnabled=true,
    session=SessionImpl(PersistenceContext[
        entityKeys=[
            EntityKey[
                planificador.UnidadProductiva#1
            ]
        ],
        collectionKeys=[
            CollectionKey[
                unidadesProductivas.Cocimiento.producto#1
            ],
            CollectionKey[
                planificador.UnidadProductiva.grupoRecursos#1
            ],
            CollectionKey[
                planificador.UnidadProductiva.lineaProduccion#1
            ]
        ]
    ];ActionQueue[
        insertions=[

        ]updates=[

        ]deletions=[

        ]collectionCreations=[

        ]collectionRemovals=[

        ]collectionUpdates=[

        ]
    ]),
    unreferenced=false,
    role=unidadesProductivas.Cocimiento.producto,
    directlyAccessible=false,
    empty=true,
    storedSnapshot={

    },
    operationQueueEnabled=false,
    value=[

    ],
    owner=unidadesProductivas.Cocimiento: 1,
    cachedSize=-1,
    class=classorg.hibernate.collection.PersistentSet,
    rowUpdatePossible=false,
    snapshot={

    },
    key=1,
    putQueueEnabled=false,
    dirty=false
}

CaldoMadreを返すメソッドまたはプロパティを期待しています

そして、これは私が使用しているクラスです

class UnidadProductiva {...}

class Cocimiento extends UnidadProductiva {
    static hasMany = [producto:CaldoMadre];
}

class Producto {
    static belongsTo = [unidadProductiva:UnidadProductiva]
}

class CaldoMadre extends Producto {...}

私はチリ人の初心者です。理解できない場合は、しばらくお待ちください。

4

1 に答える 1

0

に宣言されたフィールドがないため、Cocimiento これを動作させることはできますが、動作させることはできません。gspで使用するのは少し厄介ですが、コントローラーで使用して渡すことができるかもしれません。UnidadProductivaproductoUnidadProductiva

//in controller
import java.lang.reflect.*

//in show action or whichever makes sense
Field field = Cocimiento.class.getDeclaredField("producto");
ParameterizedType pt = (ParameterizedType) field.getGenericType();
Type concreteType = pt.getActualTypeArguments()[0];
println concreteType.getName()

com.CaldoMadreパッケージ設定で印刷します。

そして、それは中に何かがあることに依存していませんSet

于 2012-12-21T02:52:35.190 に答える