Saturday 30 July 2016

How To get Dynamic Menues Using Custom SQL view Object

Today we will Discuss How to get Dyamic Menues In Jsf Page from Menues
For this Purpose We should Have The follwing Concept


  • View Objects
  • View Links
  • Collection Model Tree,Iterotor

So we Will Complete This Topic In Three Tutorial first Of All we should have the basic idea of View Object Which is discuss in this tutorial

Sql Querry base view ViewObject decribes how the application will view and update data. A View Object may be Entity based or non-Entity based. In the former case, the View Object consists of one or more Entity bases. The first one of these is referred to as the primary Entity base. The rest are called secondary Entity bases. An Entity based View Object maps its attribute (View Attributes) to attributes in the Entities (Entity Attributes). An Entity based View Object may map all its Entity Attributes or only some of them. However, an Entity based View Object is required to map all primary key attributes of the Entity bases. An Entity based View Object may additional include attributes that are not mapped to an Entity Attribute. Such an attribute is referred to View level attribute.  A non-Entity based View Object is one where it does not have any Entity base. All its attributes are View level attributes.  View Object is responsible for managing database query statement. Regardless of whether the View Object is Entity based or not, it may have a SQL statement from which it draws its data. As rows are read from this query, it will populate a RowSet (of this View Object) with View rows.  View Object provides a number of APIs through which the client can modify and augment the query statement during runtime. For example, see ViewObject#setWhereClause().  A View level attribute (not mapped to an Entity attribute) may map to a column or a SQL expression in the query statement. It may be a transient attribute (whose data is purely in memory and not mapped to any database column/expression. Or, it may be a dynamic attribute. 


SQL Query Base View Object

 sql query base view object are used to get data from database the example of query base view  are when we get dynamic menus from database in our jsf page
Now we will discuss how to create sql queery base view object from database
Follow The Follwing Steps To Create View Object


  1. Click On model and choose View Object From Gallery To create view Object
  2. Change The Name Of view Object And Choose custom Sql Querry Then Click Next
  3. After that write Your Sql Querry (Which ever you want to get from database) and then  on bottom click "Test And Explain" the follwing message will be show "Your Querry executed Successfully"
  4. After That Click Next on attribute mapping Choose any one option
  5. After This Choose Primary Key and checked the filed "Key Attribute

  6. Then you can click next ,next and in application module checked the boxed add to application module 



Your View Object Is Ready To Use You can Access it in jsf Page

 Next Tutorial We will Leran How To link View Object  and Then Complete How to Get Dynamic Menues Using Iteroror


Thanx 
Mushtaq Wattu


No comments:

Post a Comment