Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i get the type of elements from a PersistentSet that could be empty
    primarykey
    data
    text
    <p>Well, the question explains itself, here is how i tried to do it. I think the problem might be that the Set is empty, and those methods need at least one element to return the class.</p> <p>views/product/_form.gsp</p> <pre><code>&lt;% cl = UnidadProductiva.get(params.unidadProductiva?.id).producto %&gt; &lt;p&gt;${cl}&lt;/p&gt; </code></pre> <p>returns [] </p> <p>if i add this method/attributes after producto:</p> <p><strong>.getCandidateClass() :</strong> No signature of method:<br> org.hibernate.collection.PersistentSet.getCandidateClass() is applicable for argument types: () values: []</p> <p><strong>.class :</strong><br> class org.hibernate.collection.PersistentSet</p> <p><strong>.getElementType() :</strong> No signature of method:<br> org.hibernate.collection.PersistentSet.getElementType() is applicable for argument types: () values: [] Possible solutions: getElement(java.lang.Object)</p> <p><strong>.properties :</strong> </p> <pre><code>{ 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 } </code></pre> <p>i am expecting a method or a property that returns <strong>CaldoMadre</strong></p> <p>And this are the classes i am using</p> <pre><code>class UnidadProductiva {...} class Cocimiento extends UnidadProductiva { static hasMany = [producto:CaldoMadre]; } class Producto { static belongsTo = [unidadProductiva:UnidadProductiva] } class CaldoMadre extends Producto {...} </code></pre> <p>I am a chilean noob to grails, please be patient if i dont undestand.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload