snowindy opened a new issue, #14241:
URL: https://github.com/apache/grails-core/issues/14241

   Hello I have domains like this:
   
   ```
   Charge{
   BudgetIndex budgetIndex
   }
   BudgetIndex{}
   ```
   
   page edit.gsp for Charge contains
   
   ```
   <f:all bean="chargeInstance"/>
   ```
   
   /_field/budgetIndex/_input.gsp contains
   
   ```
   <f:all bean="${value}"/>
   ```
   
   When I enter /charge/edit/1
   I get "Tag [all] currently only supports domain types" error
   
   The error is caused with the fact that 'value' is a hibernate proxy with 
class name 
   
   ```
   com.mycorp.aim.id.BudgetIndex_$$_javassist_34
   ```
   
   This needs to be fixed.
   
   I managed to solve this problem using HibernateProxyHelper, this is the code:
   
   ```
   def fAll = { attrs, body ->
           if (!attrs.bean) throwTagError("Tag [all] is missing required 
attribute [bean]")
           def bean = resolveBean(attrs.bean)
           def prefix = resolvePrefix(attrs.prefix)
           def domainClass = resolveDomainClass(bean)
   
   //-------------------------------------------------
           if (!domainClass){
               try{
                   def cl = 
HibernateProxyHelper.getClassWithoutInitializingProxy(bean)
                   domainClass = resolveDomainClass(cl)
               }catch(e){
                   log.warn(e)
               }
           }
   //-------------------------------------------------
           if (domainClass) {
               for (property in resolvePersistentProperties(domainClass, 
attrs)) {
                   out << f.field(bean: bean, property: property.name, prefix: 
prefix)
               }
           } else {
               throwTagError("Tag [all] currently only supports domain types: 
$bean.")
           }
       }
   ```
   
   Hope it helps.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to