Using Database Views in ADF

Hi,
There are Two Views in My Database and I need to join these Views as one new VO in my ADF app. (and then I need to join this VO with another entity in my app)
I tried to make Entity object of those Views but it seems that you can not make an Entity out of a Database View (and it reasonable !)
but how can I accomplish such scenarios ?
JDeveloper : 11.1.1.6
Thank you
Shahab

this is to poster.
am not hijacking this thread., i had a question with frank.
However, for CRUD operations this could soon become hairy.
go by creating two entities. Dependent on what needs to be updated in the database, you then override the doDML method of the EntityImpl classes with calls to >e.g. stored proceduresthis is to frank.
i need a confirmation for above statement.
if a dbview involves more than 1 dbtable means say as example: 3 table means
if i take a dbview as a single entity object means, how could i perform CRUD operation?it's not possible.. am right?.
so only you are saying take 2 eo make it a view (access through eo object),do crud operation seperate beyind business need.
so only you are saying become hairy

Similar Messages

  • Using database views in ADF mobile client application

    Hi,
    I am using Jdeveloper 11.1.1.4 and WLS 10.3.4.
    I have developed a POC in ADF mobile client application both with and without synchronization. However, both work with entity objects based on tables.
    I need to use database views instead of tables. When I try to include entity object (based on views) in the view object, it shows an error saying "Only the entity objects based on tables can be selected"
    Please guide me if there is a work around for this.
    Also, please let me know if there is way to develop an ADF mobile client application skipping the use of entity objects at all and using view objects directly to specify the database query and fetch data from the database.
    Thanks in advance.
    Ansh
    Edited by: ansh on Mar 28, 2011 5:40 AM

    Hi, Ansh:
    Currently, out of box, ADF Mobile Client does not support synchronization against Database Views. This is because Mobile Server imposes some schema restrictions to ensure synchronization with multi-table views would work correctly. This schema restriction requires, for example, the view must have a primary parent table with key defined, and also all base table must be included in the data publication. These dependencies requires manual resolution and advanced planning, and is managed outside of the ADF Mobile Client/JDeveloper project.
    To continue development, you would need to create server Entity Objects directly against the base tables. You can then create the mobile ADF Business Component (EOs, VOs, etc). You can then create View Objects in your ADF Mobile Client application based on the database views, in order to retrieve the data you need exactly. In other words, instead of basing EO on the database view, create View Objects in the mobile applicaiton to mimic what you had in the View Object.
    Is there any other reason why you would need to access data via database views, instead of directly against base tables?
    Thanks,
    Joe Huang

  • Is the best practice to use database views or view objects?

    Hi everyone,
    If the option is available, is it preferable consolidate as much data as possible into a database view instead of doing this through view view objects? It seems the answer would be yes, but I would like to hear the pros and cons related to performance, etc.
    While I do not mind a detailed discussion, practical "rule-of-thumb" advice is what I am after; I am a newbie that needs general guidelines - not theories.
    James

    Performance is the main driver behind the question because I am wondering if it is faster to send a single large record set across a network or several small ones and "assemble" them at the client level.
    Probably is better to send one large record, but you will need to take in account time required to create this one large record in db(maybe oracle object types, or arrays of oracle object types).
    Check this for some VO performance advices: Advanced View Object Techniques  (especially property: "In Batches Of" which defines number of roundtrips between app server and db)
    As far as creating an updatable database view, I know there are minor tricks that are required to make that happen from a strictly SQL standpoint. But, I am curious the best way to go in JDeveloper.
    Some solutions:
    Using Updatable Views with ADF | Real World ADF
    Andrejus Baranovskis's Blog: How to Update Data from DB View using ADF BC DoDML Method
    Dario

  • How to use Database views in XI

    Hi Folks,
    Any idea about how to use Database views for sending and receiving messages in XI ?
    Regards,

    Farooq,
    My doubt is do i have work in the same fashion as if i am working on a Database Table...?
    For Ex :
    Creating Source and Target Data structure for JDBC adapter in the same format....etc
    Regards.

  • TABLE FUNCTION - Using database view - send parameters to the function.

    Hi everybody:
    1.- I have a function returning a TABLE OF, and that function recieve 2 parameters of type NUMBER.
    2.- I'm able to call this function as a table function like this:
    SELECT * FROM TABLE(my_function(3,4))
    3.- I want to create a database View, To use this query in diferent places of my app.
    CREATE OR REPLACE VIEW NAME_OF_MY_VIEW AS SELECT * FROM TABLE(my_function(:_idOne,:idTwo))
    4.- My problem is, that I want to send the parameters dinamically to the function, and use those parameters to populate the rows, using a database view, the previous code does not compile... and I don't know another way to do this.
    Please help.
    thnks in advance.
    Alex.

    Yes you can:
    SQL> CREATE PACKAGE pkg
    AS
       a_global   VARCHAR2 (30);
       FUNCTION f (a VARCHAR2)
          RETURN varchar_tab;
       FUNCTION ret_global
          RETURN VARCHAR2;
       FUNCTION set_ret_global (ret_global VARCHAR2)
          RETURN INTEGER;
    END;
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY pkg
    AS
       FUNCTION f (a VARCHAR2)
          RETURN varchar_tab
       AS
          l_varchar_tab   varchar_tab := varchar_tab ();
       BEGIN
          FOR i IN 1 .. 10
          LOOP
             l_varchar_tab.EXTEND;
             l_varchar_tab (i) := a;
          END LOOP;
          RETURN l_varchar_tab;
       END f;
       FUNCTION ret_global
          RETURN VARCHAR2
       AS
       BEGIN
          RETURN a_global;
       END ret_global;
       FUNCTION set_ret_global (ret_global VARCHAR2)
          RETURN INTEGER
       AS
       BEGIN
          a_global := ret_global;
          RETURN 1;
       END set_ret_global;
    END pkg;
    Package body created.
    SQL> CREATE OR REPLACE VIEW v
    AS
       SELECT *
         FROM TABLE (pkg.f (pkg.ret_global))
    View created.
    SQL> SELECT *
      FROM v
    WHERE 1 = pkg.set_ret_global (5)
    COLUMN_VALUE                                                                   
    5                                                                              
    5                                                                              
    5                                                                              
    5                                                                              
    5                                                                              
    5                                                                              
    5                                                                              
    5                                                                              
    5                                                                              
    5                                                                              
    10 rows selected.
    SQL> SELECT *
      FROM v
    WHERE 1 = pkg.set_ret_global (4)
    COLUMN_VALUE                                                                   
    4                                                                              
    4                                                                              
    4                                                                              
    4                                                                              
    4                                                                              
    4                                                                              
    4                                                                              
    4                                                                              
    4                                                                              
    4                                                                              
    10 rows selected.

  • Using Database views in source qualifier

    Hi,
    I have a view in my database which when ran from SQL developer returns me around 1202527 records.
    But using the same view, when I write source qualifier in the Informatica Mapping (straight forward mapping without any filter etc), the number of records that get loaded into the target table is 1206771.
    There is clearly an increase in the number of records which are there in the view and which are loaded.
    Has anyone faced the same issue?
    If I can get any pointer to resolve this issue, I will be grateful.
    Thanks in advance.
    Anamika

    1. were you able to identify the extra records?
    2. were you able to confirm these records exists in original table (not in view)
    3. did your view includes any language, etc filters? usually when you execute in sql developer it returns for current language if you language filter in our view, so analyse view definition

  • Using Database Views in XI

    Hi Guys,
    We have come across requirement where we have to use Views rather then Database Tables...
    Kindly share your knowledge and views..:
    1. Is there any difference in handling the views as compred to Tables....?
    2. Like Tables do we have to create the similar type of source and target message types for views also...?
    3. From XI point ...where we can expect the difference views/ tables..in terms of developing design and configuration objects..?
    Regards,

    Hi
    Views are windows to the tables.When you create views in the DB, technically there is not much difference between them.
    Therefore just like tables we have to create similar type of source and target messages for views also.
    Moreover while developing design and configuration objects also no difference will be observed.
    Thanks

  • Database View do not refresh in ADF application

    Greetings,
    im facing a weird problem in my application (JDeveloper 11.1.2.4.0 - ADF). All this time i was working directly with tables (VO), but now i also started using database views.
    Everything works fine, when i add a new row in a table that my Database Views is associated with, it refresh properly.
    BUT if i delete rows manually from my database, the View do not refresh in my application, not by refreshing the page,
    redeploying application, even executing the view object query inside the view object. The only way for the DB View to be
    refresh inside the JDeveloper and on deployment time is by restart JDeveloper. I try adding an action on my OV to re-execute them when
    i do something specifically, hopefully the will reset the cache and retrieve the DB view again, but with no luck..
    Correction: now it doesnt even refresh on restart jdeveloper.
    Just for the clarification, im talking about Database Views, and not just Object Views. I create a Object View inside the application to retrieve the data
    from the Database View results.
    Can you help me on this please?

    Yes the queries in SQLDeveloper was showing me correct results.
    But i feel disappointed.. When i went to close SQLDeveloper to try something, it pop me a message to commit/rollback changes.
    After i commit them, my app show correct results too.

  • Snowflake dimension: named query vs. database view

    A test question features a Product table with a Product Size code; Product Size description is taken from ProductSize table. As far as I can tell, the question asks me to choose between (a) setting up a database view joining Product and ProductSize, and
    (b) doing the join in a data-source-view named query. I don't see a clear winner. (My thinking is as follows.  Yes, he view would speed up the processing, even if not materialized. On the other hand, with a small dataset, the performance gain would be
    minor in absolute terms. Do I want to have an extra database object in the picture?) Yet the question's author does. Can anyone advise please?  

    Hi Demyan,
    According to your description, you want to know which is better, using named query in datasource view or using database view, right?
    Based on my research, there is no performance differences between using named query in datasource view and using database view because they both result in SQL query being sent to the source system. Here is a blog which discuss this issue.
    Consistency: If you already have logic in database views, I would continue to use them. As long as you know that you go to one spot to view/change the logic. Putting the logic in 2 different spots could lead to confusion.
    Security Permissions: often you may not have permission to alter the source databases, in this case you have no choice but to setup named queries in the dsv.
    Reference
    http://geekswithblogs.net/darrengosbell/archive/2006/09/05/90278.aspx
    http://bennyaustin.wordpress.com/2013/07/16/dbview/
    Regards,
    Charlie Liao
    TechNet Community Support

  • 'GROUP BY' clause in Database views

    Hi,
    I use SE11 to create database view from a table. I wonder if it is possible to specify a 'GROUP BY' clause? Basically I need a database view that looks like this:-
    SELECT FISCAL_PERIOD, SUM(QUANTITY)
    FROM TABLE A
    GROUP BY FISCAL_PERIOD
    Please help!
    Thanks,
    CH

    Yes. I want to create a view that has values that are already aggregated by a field.
    Example view that i created directly in SQL database:
    CREATE VIEW ABC (F1, SUM_QTY)
    AS SELECT F1, SUM(QTY)
    FROM TABLE1
    GROUP BY F1
    My question is how to achieve the same result using Database view in SAP through transaction SE11 or any others?
    Thanks,
    CH

  • Regading Database View

    Hi,
    I have joined two tables KNA1 and KNVV using Database View. The Problem is that the Records are not getting filtered On the basis of fields from KNVV (VKORG, VTWEG,VKBUR etc) , however records are getting filtered on the basis of fields from KNA1.  What might be the problem???Please Help...

    Hai,
    In the join conditions reverse the conditions like:
    Instead of table1-field1 eq table2-field1
    Use table2-field1 eq table1-field1.
    Make sure that client (Key fields )are also be there in the join condition.
    Hope this helps you.
    Regds,
    Rama .Pammi

  • Database Views and Master-Detail using ADF

    How would I create a master-detail form using a database view for the search-able master table and a database view as the detail table?
    The detail-view will need to be update-able (adf-table) using an instead-of trigger to perform the updates to the database table.
    Thanks in advance...

    There are several sections in the ADF Developer's Guide about using views (http://www.oracle.com/technology/documentation/jdev/b25947_01/index.html):
    - 26.4 Basing an Entity Object on a PL/SQL Package API
    - 6.2.4 Creating an Entity Object for a Synonym or View
    You can also try Steve Muench's web log: http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html
    There are at least two (old) items there that involve view with instead-off triggers:
    -      Composite Entity Using Stored Procedure API to Create/Modify/Remove Master and Children
    - Entity Object Based on View With Instead Of Triggers Avoiding Returning Into Clause
    Jan Kettenis

  • Using SQL view object to create ADF table

    Hi,
    I have created a column called "Month" (which extracts month from the date column) and another column to count the no. of requests.
    i want to create an ADF table with 2 columns, a column showing the month and another is showing the no. of requests for that month.
    However, now I only managed to achieve the ADF table to show the overall total requests, which means if i add up all the requests for all the months and i get 500
    My ADF table shows this:
    Jan: 500
    Feb: 500
    Mar: 500
    How should I create the view or what should I do to make it such that the no. of request is based on the month?
    Please advice.
    Thanks (:

    Hi,
    For the given situation you can create a Query Based View Object with the following query
    SELECT
    COUNT(TEMP1.DT) REQUEST,
    TO_CHAR(TEMP1.DT, 'Mon') MONTH
    FROM
    TEMP1
    GROUP BY
    TO_CHAR(TEMP1.DT, 'Mon')
    where DT is the date column and temp1 is the name of the database table.
    Following are the steps that i followed to get this query :
    i have taken the following sample table :
    create table temp1
    (srno number primary key,
    dt date)
    *Note you may use any existing column instead of srno or use dt only (i took an extra column as u know we need a primary key /row id)
    the following is the sample data
    insert into temp1 values (1,sysdate);
    insert into temp1 values (2,sysdate);
    insert into temp1 values (3,add_months(sysdate,1));
    insert into temp1 values (4,add_months(sysdate,1));
    insert into temp1 values (5,add_months(sysdate,3));
    insert into temp1 values (6,add_months(sysdate,5));
    the table appears as follows
    SRNO DT
    1 22-JUN-12
    2 22-JUN-12
    3 22-JUL-12
    4 22-JUL-12
    5 22-SEP-12
    6 22-NOV-12
    To start with ADF View Object Creation (Using Jdeveloper 11.1.2):
    Create the view object using Create View Object wizard
    In Step 1. Name window
    set the value for Name : Viewab (you can use any of ur choice)
    In the data source section : select query
    In Step 2. Query window
    a. Click Query builder (it will pop up sql statment window)
    b. In the SQL Statement window
    in quick-pick objects section -> select temp1 table -> shuttle the columns from available list to selected list
    in select clause section -> select srno column from select list-> choose count() function from function drop down list -> insert function -> set alias to REQUEST-> click validate
    now select dt column from select list -> choose to_char() function -> click insert function -> alter the function to to_Char(temp1.DT,'Mon') -> set alias to Month -> click validate
    in the group by clause section -> Click the green symbol to add -> from the expression palette insert dt column -> insert the to_char function -> alter the function to to_char(temp1.DT,'Mon') -> click validate
    in the Entire SQL Query section -> click test query -> in the test query window -> click query result-> you will see the result -> click close -> click ok
    Click next
    Step 3: Bind Variables
    Click Next
    Step 4: Attribute Mappings
    click Finish
    So the view object is ready :)

  • Bad performance when using  complex database view with Toplink

    Hi
    Problem description
    1. I have a complex query that collects the data from many DB tables. For this reason I create a database view based on this select. Using EJB 3.0 with Toplink I
    mapped this view to a java object the same way I map database tables. The method I use to get the results is:
    snippet code...
    public List<VwKartela> VwKartela(Integer pperid) {
    List<VwKartela> results = null;
    Session session = getSessionFactory().acquireSession();
    ExpressionBuilder bankfile = new ExpressionBuilder();
    Expression exp1 = bankfile.get("perid").equal(pperid);
    ReadAllQuery query = new ReadAllQuery();
    query.setReferenceClass(VwKartela.class);
    query.setSelectionCriteria(exp1);
    results =(List<VwKartela>)session.executeQuery(query);
    When running the select on the view prom SQL Plus I haven’t any performance problem.
    2.Question: How can I improve the performance? I referenced to Toplink docs but I didn't improve the it.
    Have anyone any experience is such cases?
    Thank you
    Thanos

    Hi
    After my last tests I conclude at the followings:
    The query returns 1-30 records
    Test 1: Using Form Builder
    -     Execution time 7-8 seconds
    Test 2: Using Jdeveloper/Toplink/EJB 3.0/ADF and Oracle AS 10.1.3.0
    -     Execution time 25-27 seconds
    Test 3: Using JDBC/ADF and Oracle AS 10.1.3.0
    - Execution time 17-18 seconds
    When I use:
    session.setLogLevel(SessionLog.FINE) and
    session.setProfiler(new PerformanceProfiler())
    I don’t see any improvement in the execution time of the query.
    Thank you
    Thanos

  • ADF: use of view link Accessor in Entity Object = always null?

    Hi,
    JClient 9.0.5.2, adf model.
    I would like to use the view link accessor method in the master EO to retrieve detail EO values and the view link accessor method in the detail EO to retrieve master EO values.
    Detail Rule:
    In the detail EO an attribute is derived from an attribute of the master EO: detail attribute = master attribute.
    Master Rule:
    In the master EO an attribute is derived from the detail EO: master atribute set to 0 if detail EO exist else set to 0.
    Tables:
    Table Master => MasterEO => MasterVO
    - masterPK (not updateable)
    - masterField (not updateable)
    - hasDetailsFlag
    Table Detail => DetailEO => DetailVO
    - detailPK (not updateable)
    - masterPK => foreign key (not updateable)
    - masterField (query only)
    MasterDetailLink based on foreign key.
    In link wizard I asked for the generation of following accessors in the source & destination Entity Objects:
    In DetailEO accessor name: RetrieveFromMaster
    In MasterEO accessor name: RetrieveFromDetail
    In the DetailEO, I asked for the generation of the DetailEOImpl file, accessors and create method.
    As wriiten in the file, before the create method:
    ** Add attribute defaulting logic in this method. **
    I tought this is the place to retrieve the master attribute:
    The code:
    MasterVORowImpl masterVO = getRetrieveFromMaster();
    if (masterVO == null)
    System.out.println("MasterVORowImpl masterVO create NNNNNNNNNNNUUUUUUUULLLLLLLLLL");
    The masterVO is always null?
    I suppose I didn't understand something, my guest is that ViewObjects may not be used for default logic?
    I know how to implement those rules in the database with triggers.
    I think that the data I need for implementing those rules exist somewhere at the ADF level so retrieving the data from the db is not necessary?
    Could somebody give some clues?
    I didn't find a similar example in the Business Rules in BC4J document.
    Your help will be appreciated
    Frederic

    Hi,
    Detail Rule, copy attribute value form master.
    In DetailEOImpl:
    protected void create(AttributeList attributeList)
    setAttribute(MASTERFIELD,this.getMaster().getMasterField());
    super.create(attributeList);
    Master rule, set flag to 0 if no details else set to 1.
    In the MasterEOImpl added method to check if detail row exists based on Row Iterator => no db retrieval?
    This method also sets the flag accordingly:
    protected void checkHasOtherDetails()
    oracle.jbo.RowIterator ri = this.getRetrieveFromdetail();
    ri.last();
    // last() must be called else hasNext() returns true even on last delete ???
    Number hasDetails = Constants.NUMBER_NO; // = 1
    if (ri.hasNext() || ri.hasPrevious())
    hasDetails = Constants.NUMBER_YES; // = 0
    if (!getHasDetailsFlag().equals(hasDetails)) {
    this.setHasDetailsFlag(hasDetails);
    I call this method in the remove method of the detailEOImpl:
    public void remove()
    this.getRetrieeFromMaster().checkHasOtherDetails();
    super.remove();
    To set the flag I added follwoing code in the create method of the DetailEOImpl:
    protected void create(AttributeList attributeList)
    setAttribute(MASTERFIELD,this.getMaster().getMasterField());
    **** ADDED ***
    Number masterHasDetailsFlag = getRetrieveFromMaster().getHasDetailsFlag();
    if (!masterHasDetailsFlag.equals(Constants.NUMBER_YES)) {
    getRetrieveFromMaster().setHasDetailsFlag(Constants.NUMBER_YES));
    super.create(attributeList);
    One more question:
    Is there a danger of calling last() on row iterators in create/update/remove methods of *Impl files?
    => current row changed => any effect on display in JPanel
    Thanks
    Frederic
    PS All variable/method/class names have been manually renamed in this code so some small syntax problems may exist.

Maybe you are looking for

  • Unable to Communicate with Printer message, but still prints

    I installed a new ENVY 4500 printer on my Windows XP system. and it there are two problems: 1.  when I try to print, it tkes some time, then a message window appears with "unable to communicate with printer", but it still prints.  I have uninstalled

  • Automatic payment F110 advice notes

    Hi Sap Gurus, my client requires that with automatic payment there should be the choise to sent to vendors email, fax or letter. Does anybody know where can I choose? Which part of customizing should I activate? 10x all Alberto

  • Anyone know where i can get ichat?

    A while back i accidentally deleted my ichat thinking i would be able to re download off the internet but i had thought wrong lol. I dont know where the CD's are that my comp came with and apple sent me some but they didnt even work, unless i wasnt d

  • Why perldoc does not work?

    Hello, Guys Here is a weird question I have: Why "man perldebug" has output but "perldoc perldebug" shows "No documentation found for "perldebug"."? Do I have to install xtools to make it work (I am not a developer and xtools is a little bit large fo

  • Oracle APPS DBA requirement

    Hi All, There is a requirement for Oracle APPS DBA with 2+ sound practical experience on managing Oracle APPS( modules financial,CRM,Inventory,Purchase) in a telecom company in Northern India. Salary package will be best in the market and depends on