Sunday, July 4, 2010

Updatable View and Read Only View in ADF 11.1.1.2.0

Difference in Components


Both Types of views have some common components like ViewAttribute and DesignTime .Updatable View uses Underlying Entity objects where as Read only view doesn't require any underlying Entity Object as it uses SQL Query. Below snap shows the difference between an Updatable view based on "ExpertiseAreas" database object and a read only view for same (ExpertiseAreas) object from its component's stand point.



DesignTime components are common in both types of view but <Attr> is having different values.

Updatable View

Read Only View

<DesignTime>

<Attr Name="_codeGenFlag2"

Value="Access|VarAccess"/>

</DesignTime>

<DesignTime>

<Attr Name="_isExpertMode" Value="true"/>

</DesignTime>


Updatable View uses Underlying Entity objects where as Read only view doesn't require any underlying Entity Object as it uses SQL Query.

Updatable View

Read Only View

<EntityUsage

Name="ExpertiesAreas"

Entity="model.ExpertiesAreas"/>


<SQLQuery>

<![CDATA[SELECT ExpertiesAreas.PROD_ID,

ExpertiesAreas.USER_ID,

ExpertiesAreas.EXPERTISE_LEVEL,

ExpertiesAreas.NOTES

FROM EXPERTISE_AREAS ExpertiesAreas]]>

</SQLQuery>


As it is a read only view it contains two attributes IsUpdateable and IsPersistent and their value is set to false. Updatable view have EntityAttrName and EntityUsage as it is dependent on underlying entity Objects to represent a column where as Read Only View is using Type, ColumnType, Expression and SQLType to represent same. Please refer below table where an Updatable View having column ProdId represents it and same thing is represented in Read Only View.

Updatable View

Read Only View

<ViewAttribute

Name="ProdId"

IsNotNull="true"

PrecisionRule="true"


EntityAttrName="ProdId"

EntityUsage="ExpertiesAreas"

AliasName="PROD_ID">

</ViewAttribute>

<ViewAttribute

Name="ProdId"

IsNotNull="true"

PrecisionRule="true"


IsUpdateable="false"

IsPersistent="false"


Type="oracle.jbo.domain.Number"

ColumnType="NUMBER"

AliasName="PROD_ID"


Expression="PROD_ID"

SQLType="NUMERIC">

<DesignTime>

<Attr Name="_DisplaySize" Value="22"/>

</DesignTime>

</ViewAttribute>

No comments:

Post a Comment