9 Replies Latest reply: Nov 30, 2012 2:11 AM by Jobinesh-Oracle RSS

    Transient Entity Objects

    Vik Kumar
      Hi

      Was wondering if there is anything like a Transient Entity Object like Transient View Objects ? If yes how to implement?
        • 1. Re: Transient Entity Objects
          Alejandro Tovar Lanz
          Hi,

          Yes. You can use the wizard to create a new Entity Object but this time unselect the option which says 'Existing Object' under the schema object field. After this you will get a warning saying that you didn't specify a schema object and if you want to use your EO name as schema object, so you press NO and after that you will have an EO which is 'Transient' because it doesn't touch the DB. (you can add as many transient attributes you want)

          Regards
          • 2. Re: Transient Entity Objects
            Vik Kumar
            on doing that i got the following error on comiple

            Error: myapp.model.entity.EntityObjectEO: Entity myapp.model.entity.EntityObjectEO has persistent attributes and therefore is required to have a schema object name.

            the generated def looks like

            <?xml version="1.0" encoding="UTF-8" ?>
            <!DOCTYPE Entity SYSTEM "jbo_03_01.dtd">
            <!---->
            <Entity
            xmlns="http://xmlns.oracle.com/bc4j"
            Name="EntityObjectEO"
            Version="11.1.1.62.68"
            InheritPersonalization="true"
            DBObjectType="table"
            AliasName="EntityObjectEO"
            BindingStyle="OracleName"
            UseGlueCode="false"
            RowClass="oracle.apps.fnd.applcore.oaext.model.OAEntityImpl"
            DefClass="oracle.apps.fnd.applcore.oaext.model.OAEntityDefImpl">
            <DesignTime>
            <AttrArray Name="_publishEvents"/>
            </DesignTime>
            <Attribute
            Name="Attr"
            IsUpdateable="while_insert"
            IsNotNull="true"
            Precision="80"
            ColumnName="ATTR"
            SQLType="VARCHAR"
            Type="java.lang.String"
            ColumnType="VARCHAR2"
            PrimaryKey="true"/>
            <Attribute
            Name="Attr1"
            ColumnName="ATTR1"
            SQLType="NUMERIC"
            Type="java.math.BigDecimal"
            ColumnType="NUMBER"/>
            <Attribute
            Name="Attr2"
            ColumnName="ATTR2"
            SQLType="NUMERIC"
            Type="java.lang.Long"
            ColumnType="LONGINT"/>
            <Key
            Name="EntityobjecteoPrimaryKey"
            PrimaryKey="true">
            <DesignTime>
            <Attr Name="_DBObjectName" Value="ENTITYOBJECTEO_PRIMARY_KEY"/>
            </DesignTime>
            <AttrArray Name="Attributes">
            <Item
            Value="oracle.apps.afg.creditRules.model.entity.EntityObjectEO.Attr"/>
            </AttrArray>
            </Key>
            <Key
            Name="NoNameAttrCheck">
            <DesignTime>
            <Attr Name="_isNotNull" Value="true"/>
            <Attr Name="_DBObjectName" Value="NO_NAME_ATTR_CHECK"/>
            <Attr Name="_checkCondition" Value='"ATTR" IS NOT NULL'/>
            <Attr Name="_isCheck" Value="true"/>
            </DesignTime>
            <AttrArray Name="Attributes">
            <Item
            Value="oracle.apps.afg.creditRules.model.entity.EntityObjectEO.Attr"/>
            </AttrArray>
            </Key>
            </Entity>
            • 3. Re: Transient Entity Objects
              Alejandro Tovar Lanz
              Hi,

              How did you created those attributes??
              <Attribute
              Name="Attr1"
              ColumnName="ATTR1"
              SQLType="NUMERIC"
              Type="java.math.BigDecimal"
              ColumnType="NUMBER"/>
              Those attributes are not transient. You need to go to your attributes properties and uncheck the option which says 'Mapped to column or SQL'. After that your attributes will become transient.
              • 4. Re: Transient Entity Objects
                Vik Kumar
                i created these in the eo creation wizard only. The property you are talking about is in VOs not in EOs. Or I am missing something?
                • 5. Re: Transient Entity Objects
                  Alejandro Tovar Lanz
                  Hi,

                  Ok in that case when you are creating them on the EO wizard, you have to uncheck 'Persistent' attribute. By doing this you create the attributes as Transient. What is you use case? Why do you need a transient EO?
                  • 6. Re: Transient Entity Objects
                    Vik Kumar
                    in that case the def of attribute becomes
                    <Attribute
                    Name="Attr1"
                    ColumnName="$none$"
                    SQLType="VARCHAR"
                    Type="java.lang.String"
                    ColumnType="$none$"
                    IsQueriable="false"
                    IsPersistent="false"/>


                    so along with adding IsPersistent="false" it also replace ColumnType and ColumnName to $none$

                    does that look fine to u?

                    my use case is complicated to explain so would like to avoid to confuse you here.

                    Edited by: Vik2 on Nov 30, 2012 6:29 AM
                    • 7. Re: Transient Entity Objects
                      Alejandro Tovar Lanz
                      Hi,

                      That's fine. And yes, that is normal since it is a transient attribute and you are not using DB object so you dont have any column to map your attribute so it has to be none which is normal for this cases.

                      Regards
                      • 8. Re: Transient Entity Objects
                        Vik Kumar
                        so the problem by this sort of configuration is

                        I have then created a VO based on this EO and enabled expert mode to write the query. on dropping this vo on ui as a table it render fine when all the attribute are of type outputText. Though it fails if i change any of the attribute to input type. My requirement is to be able to create rows in this VO and in another EOImpl accessing the row from the EO and push it to some other EO (dont ask why as thats the only possibility due to some restrictions)

                        The exception i see on using table column types as input is as follows: (This comes on just running the page)

                        java.lang.ArrayIndexOutOfBoundsException: 0
                             at oracle.adf.model.binding.DCIteratorBinding.reserveRowWithKey(DCIteratorBinding.java:4032)
                             at oracle.jbo.uicli.binding.JUIteratorBinding.reserveRowWithKey(JUIteratorBinding.java:483)
                             at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.setupRegionIteratorBinding(JUCtrlHierNodeBinding.java:2262)
                             at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.getRegionBinding(JUCtrlHierNodeBinding.java:2220)
                             at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.getBindings(JUCtrlHierNodeBinding.java:2063)
                             at oracle.jbo.uicli.binding.JUCtrlHierNodeBinding.internalGet(JUCtrlHierNodeBinding.java:1523)
                             at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierNodeBinding.internalGet(FacesCtrlHierNodeBinding.java:119)
                             at oracle.adf.model.binding.DCControlBinding.get(DCControlBinding.java:749)
                             at oracle.adfinternal.view.faces.model.HierNodeBindingELResolver.getValue(HierNodeBindingELResolver.java:52)
                             at oracle.adfinternal.view.faces.model.AdfELResolver.getValue(AdfELResolver.java:89)
                             at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
                             at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:173)
                             at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:200)
                             at com.sun.el.parser.AstValue.getTarget(Unknown Source)
                             at com.sun.el.parser.AstValue.isReadOnly(Unknown Source)
                             at com.sun.el.ValueExpressionImpl.isReadOnly(Unknown Source)
                             at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.getUncachedReadOnly(EditableValueRenderer.java:489)
                             at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.cacheReadOnly(EditableValueRenderer.java:416)
                             at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.beforeEncode(LabeledInputRenderer.java:128)
                             at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:340)
                             at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
                             at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
                             at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:405)
                             at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2778)
                             at oracle.adfinternal.view.faces.renderkit.rich.table.BaseColumnRenderer.renderDataCell(BaseColumnRenderer.java:1398)
                             at oracle.adfinternal.view.faces.renderkit.rich.table.BaseColumnRenderer.encodeAll(BaseColumnRenderer.java:105)
                             at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1431)
                             at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
                             at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
                             at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
                             at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:405)
                             at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2778)
                             at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.renderDataBlockRows(TableRenderer.java:2121)
                             at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer._renderSingleDataBlock(TableRenderer.java:1777)
                             at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer._handleDataFetch(TableRenderer.java:1087)
                             at oracle.adfinternal.view.faces.renderkit.rich.TableRenderer.encodeAll(TableRenderer.java:559)
                             at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1431)
                             at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:341)
                             at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
                             at org.apache.myfaces.trinidad.component.UIXCollection.encodeEnd(UIXCollection.java:538)
                             at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)

                        Edited by: Vik2 on Nov 30, 2012 7:34 AM
                        • 9. Re: Transient Entity Objects
                          Jobinesh-Oracle
                          I have then created a VO based on this EO and enabled expert mode to write the query.
                          It means that your EO is not transient rather mapped to some columns in a database table. I you want the user to edit some fields and still do not want this changes to be persisted + need other EO features, then override doDML() and call setPostedToDB(true); and dot call super.doDML() . I have not tested this specifc scenario, but looking at the f/w source this may meet your use case

                          If this is used just like place holder, then read the following topic in dev guide [43.8.5 How to Use Transient View Objects to Store Session-level Global Variables|http://docs.oracle.com/cd/E24382_01/web.1112/e16182/bcstatemgmt.htm#ADFFD19610]