1 Reply Latest reply: Nov 14, 2012 1:40 AM by Frank Nimphius-Oracle RSS

    how to get default value using VA

    Vik Kumar-Oracle
      using jdev 11.1.1.6.2

      I defined a transient attribute with a default expresssion as
      oracle.jbo.Row r = getPayeeNameVA().first();
      if(r != null)
      return r.getAttribute("PartyName");


      I have a VO named PayeeVO with a vc haiving one bind variable. This VO is used to create PayeeNameVA view accessor. In PayeeNameVA the default VC is shuttled and value is bound to one of the view attribute.

      However, on running the app I get below exception. please advise
      aused by: oracle.jbo.JboException: JBO-29000: Unexpected exception caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException, msg=Cannot cast object 'oracle.jbo.script.ExprEvalWrapper@3b50bd53' with class 'oracle.jbo.script.ExprEvalWrapper' to class 'oracle.jbo.Row'
           at oracle.jbo.ExprEval.internalEvaluateGroovyScript(ExprEval.java:1411)
           at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1457)
           at oracle.jbo.ExprEval.doEvaluate(ExprEval.java:1435)
           at oracle.jbo.ExprEval.evaluateForRow(ExprEval.java:1217)
           at oracle.jbo.server.AttributeDefImpl.evaluateTransientExpression(AttributeDefImpl.java:2262)
           at oracle.jbo.server.ViewRowStorage.getAttributeInternal(ViewRowStorage.java:1884)
           at oracle.jbo.server.ViewRowImpl.getAttributeValue(ViewRowImpl.java:1940)
           at oracle.jbo.server.ViewRowImpl.getAttributeInternal(ViewRowImpl.java:883)
           at oracle.apps.afg.creditRules.model.view.CreditReceiversVORowImpl.getPayeeName(CreditReceiversVORowImpl.java:780)
           at oracle.apps.afg.creditRules.model.view.CreditReceiversVORowImpl$AttributesEnum$2.get(CreditReceiversVORowImpl.java:39)
           at oracle.apps.afg.creditRules.model.view.CreditReceiversVORowImpl.getAttrInvokeAccessor(CreditReceiversVORowImpl.java:830)
           at oracle.jbo.server.ViewRowImpl.getAttribute(ViewRowImpl.java:913)
           at oracle.jbo.uicli.binding.JUCtrlValueBinding.internalGetAttributeValueFromRow(JUCtrlValueBinding.java:1137)
           at oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeFromRow(JUCtrlValueBinding.java:731)
        • 1. Re: how to get default value using VA
          Frank Nimphius-Oracle
          Hi,

          apparently you access the wrong object, which is ExprEvalWrapper, and this cannot be cast to the Row object you really want to work with. I assume that Row is wrapped by this class. However, the ExprEvalWrapper is for internal framework use and the super class, which is org.codehaus.groovy.runtime.wrappers.PojoWrapper, exposes the getWrappeed method as a protected method. Without knowing your exact use case I think you will need to find another solution (e.g. expose a method on the entity impl class you then call from Groovy)

          Frank