View Objects , whereclauseparam and PERFORMANCE in JSP

We experience that using the method setWhereClauseParam gives VERY BAD performance in our JSP applications.
According to JDev team and others, "best practice" is to use setWhereClauseParam(s), so we wonder why the performance degrade significantly compared to a simpler approach (=define the whereclause when the datasource is created). To avoid the shared pool to grow we were tempted to use the recommended best-practice-parameter-binding approach, but due to performance we had to drop that idea.
Our JSP (pseudo) code look like this:
<jbo:ApplicationModule id="am" .......
<jbo:DataSource id="ds" appid="am" viewobject="ourView" rangesize="0"/>
<%
ViewObject ourVo= ds.getApplicationModule().FindViewObject("ourView");
ourVo.setWhereClauseParam(0, 'xxx');
ourVo.setWhereClauseParam(1, 'yyy');
%>
<jbo:RowsetIterate datasource="ds" >
bla bla bla ..
</jbo:RowsetIterate>
THIS IS SLOW !! ..... compared to:
<jbo:ApplicationModule id="am" .......
<% String clause = "Col1 = 'xxx' and Col2 = 'yyy' %>
<jbo:DataSource id="ds" appid="am" whereclause='<%= clause %>' viewobject="LabelHeadersView" rangesize="0"/>
<jbo:RowsetIterate datasource="ds" >
bla bla bla ..
</jbo:RowsetIterate>
We get the same results but the last method is times 100 faster ??
Any ideas are appreciated .
Thanks, Jens

OK. I believe I now know what the culprit it. It is your use of the where clause fragment:
(pdk_files_id = ? OR ? IS NULL)
Here's how I arrived at this (while at the same time ruling BC4J out of the picture as a potential cause of the problem).
I following the steps below:
[list]
[*]Connected as SCOTT in SQLPlus, I create the table:
CREATE TABLE files( pdk_files_id NUMBER PRIMARY KEY, name VARCHAR2(20));
[*]I insert one row into the new files table:
INSERT INTO files values (1111, 'SteveTest');
COMMIT;
[*]I connect as SYSTEM, an run the script ORACLE_HOME/sqlplus/admin/plustrce.sql to create the SQL*Plus PLUSTRACE role so that SCOTT will be able to use the SQLPlus AutoTrace feature
[*]As SYSTEM still, I ran the command: GRANT PLUSTRACE TO SCOTT
This gives SCOTT the privilege to use the SQL*Plus autotrace command
[*]I connect as SCOTT, and run the script ORACLE_HOME/rdbms/admin/utlxplan.sql
this created the plan table in my SCOTT schema needed to run the autotrace feature
[*]In SQLPLUS, still connected as SCOTT I issue the command:
SET AUTOTRACE ON EXPLAIN
[*]Then I do the following to create a SQL*Plus bind variable
VAR v VARCHAR2(20)
[*]And then do the following to set its value at the SQL*Plus command prompt:
EXEC :v := '1111';
[list]
Finally, I try some different queries and look at the autotrace output:
SQL> select * from files where pdk_files_id = 1111
  2  /
PDK_FILES_ID NAME
        1111 SteveTest
Execution Plan
   0      SELECT STATEMENT Optimizer=CHOOSE
   1    0   TABLE ACCESS (BY INDEX ROWID) OF 'FILES'
   2    1     INDEX (UNIQUE SCAN) OF 'SYS_C003006' (UNIQUE).
This shows that using the literal value 1111 uses the index.
SQL> select * from files where (pdk_files_id = 1111 or 1111 is null)
  2  /
PDK_FILES_ID NAME
        1111 SteveTest
Execution Plan
   0      SELECT STATEMENT Optimizer=CHOOSE
   1    0   TABLE ACCESS (BY INDEX ROWID) OF 'FILES'
   2    1     INDEX (UNIQUE SCAN) OF 'SYS_C003006' (UNIQUE).
This shows that using the literal values together with the OR clause, still uses the index.
SQL> select * from files where (pdk_files_id = :v)
  2  /
PDK_FILES_ID NAME
        1111 SteveTest
Execution Plan
   0      SELECT STATEMENT Optimizer=CHOOSE
   1    0   TABLE ACCESS (BY INDEX ROWID) OF 'FILES'
   2    1     INDEX (UNIQUE SCAN) OF 'SYS_C003006' (UNIQUE).
Using my ":v" bind variable I defined, it uses the index, too, even though the type of the bind variable is VARCHAR2 and the type of the PDK_FILES_ID column is NUMBER. This is because this is a simple enough case for the database to do automatic type coersion to convert my string value '1111' for the bind variable into the number value 1111 and then use that for the index lookup.
HOWEVER, when I try the case that simulates what you are doing in BC4J, which is using a bind variable together with the OR clause for the NULL test, we see...
SQL> select * from files where (pdk_files_id = :v OR :v IS NULL)
  2  /
PDK_FILES_ID NAME
        1111 SteveTest
Execution Plan
   0      SELECT STATEMENT Optimizer=CHOOSE
   1    0   TABLE ACCESS (FULL) OF 'FILES'.
So in this case, the database DOES NOT use the index, and hence explains why your query is slow.
I believe the database works this way because when it hard-parses the SQL statement, it is at this time that it determines the query plan for the SQL statement. The plan needs to remain stable since the same plan will be cached and reused for all uses of the same parsed SQL statement, so the plan cannot be conditional based on the values of the bind variables. Since it cannot decide without knowing the value of the bind variable, it apparently disqualifies your index from being used.
Even introducing an optimizer hint only improves the problem a little. I tried this example:
SQL> select /*+INDEX (files sys_c003006)*/ *
  2  from files where (pdk_files_id = :v or :v IS NULL)
  3  /
PDK_FILES_ID NAME
        1111 SteveTest
Execution Plan
   0      SELECT STATEMENT Optimizer=CHOOSE (Cost=826 Card=5 Bytes=125)
   1    0   TABLE ACCESS (BY INDEX ROWID) OF 'FILES' (Cost=826 Card=5 Bytes=125)
   2    1     INDEX (FULL SCAN) OF 'SYS_C003006' (UNIQUE) (Cost=26 Card=82).
In this case it still has to fully scan the index where above it was able to do a unique scan.
MORAL OF THE STORY:The tiny cost of having two different View Objects in your application, one to use when you want to find by PDK_FILES_ID, and one to use when you want to find by your other key criteria, is well worth the performance improvement that can be had by using bind variables and using them in a way that the database will use the index.
As Tom Kyte says in his excellent book Expert One on One: Oracle in a passage that made me laugh:
"If I were going to write a book about building Oracle applications that do not scale, "Don't Use Bind Variables" would be the first and last chapter." :-)
So, by using a few design-time-created view objects that uses bind variables and avoid the use of the (COL = ? OR ? IS NULL) construct, you get the following benefits:
[list]
[*]The database doesn't have to hard-parse your SQL statement each time you execute it (which it does if you keep sending queries that have literal values in the SQL statement, making each query different as far as the SGA is concerned)
[*]The indexes will get used correctly as we saw above
[*]Your code actually might be clearer, since you can name one of your view objects "FindFileById" and the other one "FindFileByName", or what have you
[list]
Hope this helps.

Similar Messages

  • Validation at View Object level and not Enity Object

    How would you create validation logic at the view object level and not at the entity object level? I have many VOs that reference the same EO and want some validation logic to be applied only to certain VOs.
    Thanks,
    Quoc

    My use case for this is to perform form validation inputted by the user via a JSPX page.

  • Questions on ADF View Objects, Links and Iterators

    I have a number of questions regarding using ViewObjects in applications where there are alot of relationships between tables.
    First, lets say that I have ViewObject SomeView that was added to the App Module (AM) as VO1. And because it has a number of "detail" records that have to be iterated through in a "report like" view it has those other VO's added under it as "children" in the AM.
    So I have
    VO1 (an instance of SomeView)
    --> VO2 (an instance of some other view)
    --> VO3 (an instance of some other view)
    that is used on pages where only a single VO1 is shown at a time.
    Now because I had another page I wanted to make that had a listing of all SomeView objects. Some of the fields in SomeView are foreign keys to records in VO2 and VO3 and while I don't want to show all the fields from VO2 and VO3, I do want to show a name field from each rather than just the foreign key.
    My experience (though I've never read this anywhere) tells me that when doing a "table" that is a list of rows from a VO, you can't display info from the child VO's because the child VO's are on whatever record corresponds to the "currentRow" in the parent VO and just displaying the rows in a rangeSet doesn't make each the "currentRow" so even we display 10 records in a for loop, the "currentRow" is just one, and the child VO's iterators aren't moved as we go through the for loop. (Can someone confirm if I am correct on this conclusion????)
    So the only way I know of to show some field from a related table in each row is to make the VO have the entity objects from the related tables be part of the view as references. Is this the only way?
    If I do that on a view that didn't have other views as children defined in the AM I don't have any problem and it works like I want.
    But if I do it on a view that did have other views as children defined in the AM it makes the page(s) using that view with the children iterators behave badly. Half the information quits showing up, etc.
    For example, ... if I go to the "SomeView" which was defined with only one entity object association, and I add the entity objects (that are the basis of instances of VO2 and VO3 ) as referenceable only, it totally breaks the page where I display a single VO1 and use it's VO2 and VO3 children. IS THIS NORMAL OR AM I MISSING SOMETHING?
    So, is the solution that I have to have more view objects defined for different purposes ?
    Can anyone give any general guidelines for when/where to use different view objects vs. when to use different iterators. I'm not having much luck with using secondary RSI's and haven't found much info on them.
    Also, how about issues of naming iterators that are in various binding containers (ie. UI Model for a page). If I do and LOV it creates an iterator and gives it a default name like ViewNameIterator1. If I already have a different page that uses a regular (non LOV) iterator with that name, and the user goes back and forth between those pages, is that a clash?
    Finally, I've read a couple of Steve Muench's blogs on View Link consistency but I'm not sure what the rules are on when it applies and doesn't. How you turn it on or off, etc. One of his examples in http://radio.weblogs.com/0118231/2004/02/27.html talks about it in the context of two view objects that are NOT typically "linked" in a master/detail kind of way. Like an AllDepartments and a DepartmentsLessThan view. Do you have to create a View Link between them to have results of one be reflected in the other if they aren't used in the same page in a web app? Or does it happen automatically (with the caveat that you have to do the rowQualifies method). Just feels like I'm missing some pieces.
    Thanks in advance,
    Lynn

    Hi,
    I am also interested in a best-practice note from oracle.
    Currently we store history in seperate history tables for columns that changed. All this implemented in our BaseEoImpl overriding the EntityImpl.prepareForDML().
    Thanks

  • Dynamic View Object Creation and Scope Question

    I'm trying to come up with a way to load up an SQL statement into a view object, execute it, process the results, then keep looping, populating the view object with a new statement, etc. I also need to handle any bad SQL statement and just keep going. I'm running into a problem that is split between the way java scopes objects and the available methods of a view object. Here's some psuedo code:
    while (more queries)
    ViewObject myView = am.createViewObjectFromQueryStmt("myView",query); //fails if previous query was bad
    myView.executeQuery();
    Row myRow = myView.first();
    int rc = myView.getRowCount();
    int x = 1;
    myView.first();
    outStr = "";
    int cc = 0;
    while (x <= rc) //get query output
    Object[] result = myRow.getAttributeValues();
    while (cc < result.length)
    outStr = outStr+result[cc].toString();
    cc = cc+1;
    x = x+1;
    myView.remove();
    catch (Exception sql)
    sql.printStackTrace(); myView.remove(); //won't compile, out of scope
    finally
    myView.remove(); //won't compile, out of scope
    //do something with query output
    Basically, if the queries are all perfect, everything works fine, but if a query fails, I can't execute a myView.remove in an exception handler. Nor can I clean it up in a finally block. The only other way I can think of to handle this would be to re-use the same view object and just change the SQL being passed to it, but there's no methods to set the SQL directly on the view object, only at creation time as a method call from the application module.
    Can anyone offer any suggestions as to how to deal with this?

    I figured this out. You can pass a null name to the createViewObjectFromQueryStmt method, which apparently creates a unqiue name for you. I got around my variable scoping issue by re-thinking my loop logic.

  • Jdev 11g AD / View Objects - update and populate web service data contro

    Hi Experts....
    Looking for the best approach here.
    I am hoping that someone can provide me some thoughts / guidance around the best way to achieve populating a webservice data control from a view object.
    Basically I have created an application pulling data from source tables using ADF BC VO's. I am going to put a command button 'Update Record', that will open up a dialog with a web service data control.
    I am hoping to be able to populate the data control fields, with values from the selected record VO.
    I am tipping at this stage, I will need to do this programatically?
    Is this the recommended approach?
    Any examples of code?
    Thanks in advance to anyone that can help!
    Simo

    Should be similar to this:
    http://blogs.oracle.com/shay/2011/03/passing_parameters_between_web.html
    But the first page would get the data from the VO instead of Webservice.
    Since you are using PL/SQL API in the database to do the update, it might be more efficient to just have an AM service method that uses the existing JDBC connection/transaction and calls this PL/SQL stored procedures and passes info from the VO.
    See: http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/bcadvgen.htm#BABEIFAI
    Or taking it even further:
    http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/bcadveo.htm#sm0328

  • DOC BUG: 9.0.3.1 View Object Wizard and a Question

    First the question: What is the Passivate property for in the View Object Wizard's Attribute Settings page?
    Related Doc Bugs 9.0.3.1
    Topic: Define New View Attribute Dialog
    (click Help button in New Attribute dialog when creating a view object attribute)
    Problems: The description for the "Attribute" property is "foo"; Descrimator, Updateable, and Queriable have single letter descriptions. Key Attribute and Passivate are not listed.
    Topic: View Object Wizard - Attribute Settings Page
    (click Help button in Attribute Settings page in View Object Wizard)
    Problems: Query Column Type and Passivate are not listed. Attribute Settings column lists properties in a strange order (not a bug).
    Peter Koletzke

    Peter,
    I've logged doc bug 2814172: BC4J GLOSSARY SHOULD HAVE ENTRIES FOR PASSIVATE AND ACTIVATE.
    For more information, you could read the "About Application Module Pooling" topic in the online documentation. Passivation is what happens when the application module's state is saved to the database - and activation happens when an application module instance retrieves passivated state from the database.
    Thanks
    Blaise

  • HTMLDB webapp's scalibility, relibility, and performance vs JSP or ASP apps

    I am new to HTMLDB. It seems that HTMLDB is getting more attention now than before. I am interested in it, does anyone who knows it inside out regarding its pros and cons vs JSP and ASP apps shed some light about HTMLDB apps?
    I heard that asktom.com is created by it, but it seems that users are limited, is there any enterprise apps created by it, if yes, could you list the url?
    Thanks a lot,
    John

    I just answered your earlier thread starting June 4th...
    pls look here:
    Performance? J2EE versus HTMLDB
    originally started on J2EE vv. HTML DB on "performance"
    brgds
    Bernhard

  • 10g doing VIEW type join even when no view in SQL - and performing poorly

    Using 10.2.0.2.0
    Every once in a while I see CBO deciding to use VIEW type join even when there is no view in the SQL and whenever it does that the performance just sucks.
    Example –
    SQL-
    SELECT a.emplid, a.empl_rcd, TO_CHAR (((a.dur) + (:"SYS_B_00")), :"SYS_B_01"),
    a.seqnum
    FROM ps_wrk_adhoc_tao5 a, ps_tl_prof_wrk5 b, ps_tl_empl_data c
    WHERE a.dur =
    (SELECT MAX (a1.dur)
    FROM ps_wrk_adhoc_tao5 a1
    WHERE a1.process_instance = :"SYS_B_02"
    AND a1.emplid = a.emplid
    AND a1.empl_rcd = a.empl_rcd)
    AND a.dur < TO_DATE (:"SYS_B_03", :"SYS_B_04")
    AND NOT EXISTS (
    SELECT :"SYS_B_05"
    FROM ps_tl_ta_exceptn5 q
    WHERE q.process_instance = :"SYS_B_06"
    AND q.exception_id = :"SYS_B_07"
    AND q.emplid = a.emplid
    AND q.empl_rcd = a.empl_rcd
    AND q.dur = a.dur)
    AND :"SYS_B_08" = :"SYS_B_09"
    AND c.emplid = a.emplid
    AND b.emplid = a.emplid
    AND c.empl_rcd = a.empl_rcd
    AND b.empl_rcd = a.empl_rcd
    AND c.effdt =
    (SELECT MAX (c1.effdt)
    FROM ps_tl_empl_data c1
    WHERE c1.emplid = c.emplid
    AND c1.empl_rcd = c.empl_rcd
    AND c1.effdt <= ((a.dur) + (:"SYS_B_10")))
    AND b.effdt =
    (SELECT MAX (b1.effdt)
    FROM ps_tl_prof_wrk5 b1
    WHERE b1.process_instance = :"SYS_B_11"
    AND b1.emplid = b.emplid
    AND b1.empl_rcd = b.empl_rcd
    AND b1.effdt <= ((a.dur) + (:"SYS_B_12")))
    AND c.time_rptg_status = :"SYS_B_13"
    AND b.empl_status IN (:"SYS_B_14", :"SYS_B_15", :"SYS_B_16", :"SYS_B_17")
    AND a.process_instance = :"SYS_B_18"
    AND b.process_instance = :"SYS_B_19"
    Plan –
    Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE 1 18
    NESTED LOOPS ANTI 1 153 13
    NESTED LOOPS 1 125 12
    NESTED LOOPS 1 103 10
    HASH JOIN 1 76 9
    INDEX RANGE SCAN SYSADM.PS0WRK_ADHOC_TAO5 7 245 2
    SORT AGGREGATE 1 21
    TABLE ACCESS BY INDEX ROWID SYSADM.PS_WRK_ADHOC_TAO5 6 126 3
    INDEX RANGE SCAN SYSADM.PS_WRK_ADHOC_TAO5 6 2
    VIEW SYS.VW_SQ_1 524 20 K 6
    HASH GROUP BY 524 40 K 6
    FILTER
    MERGE JOIN 1 K 124 K 5
    SORT JOIN 151 5 K 2
    INDEX RANGE SCAN SYSADM.PS_TL_PROF_WRK5 151 5 K 1
    SORT JOIN 214 8 K 3
    INDEX RANGE SCAN SYSADM.PS0WRK_ADHOC_TAO5 214 8 K 2
    TABLE ACCESS BY INDEX ROWID SYSADM.PS_TL_PROF_WRK5 1 27 1
    INDEX UNIQUE SCAN SYSADM.PS_TL_PROF_WRK5 1 0
    TABLE ACCESS BY INDEX ROWID SYSADM.PS_TL_EMPL_DATA 1 22 2
    INDEX RANGE SCAN SYSADM.PS_TL_EMPL_DATA 1 1
    SORT AGGREGATE 1 20
    FIRST ROW 1 20 2
    INDEX RANGE SCAN (MIN/MAX) SYSADM.PS_TL_EMPL_DATA 1 20 2
    INDEX RANGE SCAN SYSADM.PS_TL_TA_EXCEPTN5 1 28 1
    If I use a rule hint here I get this plan. I get the plan given below on another database even without the rule hint –
    Operation Object Name Rows Bytes Cost Object Node In/Out PStart PStop
    SELECT STATEMENT Optimizer Mode=HINT: RULE
    FILTER
    FILTER
    TABLE ACCESS BY INDEX ROWID SYSADM.PS_TL_EMPL_DATA
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID SYSADM.PS_TL_PROF_WRK5
    INDEX RANGE SCAN SYSADM.PS_TL_PROF_WRK5
    TABLE ACCESS BY INDEX ROWID SYSADM.PS_WRK_ADHOC_TAO5
    INDEX RANGE SCAN SYSADM.PS_WRK_ADHOC_TAO5
    INDEX RANGE SCAN SYSADM.PS_TL_EMPL_DATA
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID SYSADM.PS_WRK_ADHOC_TAO5
    INDEX RANGE SCAN SYSADM.PS_WRK_ADHOC_TAO5
    INDEX RANGE SCAN SYSADM.PS_TL_TA_EXCEPTN5
    SORT AGGREGATE
    INDEX RANGE SCAN SYSADM.PS_TL_EMPL_DATA
    SORT AGGREGATE
    INDEX RANGE SCAN SYSADM.PS_TL_PROF_WRK5
    The whole schema was analyzed using dbms.stats only yesterday. My question is why is Oracle doing VIEW, and how can I stop it from doing that. Hint is not an option.

    I understand that SQL Developer takes it's NLS settings from Preferences - Database - NLS Parameters. What I was not aware of is that when SQL Developer is run for the first time the NLS Parameters seem to be populated from the settings on the OS of the PC it is running on. To test that this was the case I did the following
    I work on a Windows XP system with Regional Options - Standards and Formats and Regional Options - Location set with English (United Kingdom) and United Kingdom respectively.
    I unzipped two clean SQL Developer instances (both Version 1.2.1). The first instance I first ran under my current PC set up without importing settings from a previous installation. The Preferences - Database - NLS Parameters - Language and Preferences - Database - NLS Parameters - Territory had been populated with English and United Kingdom.
    I then changed the Regional Options on the OS to English (United States) and United States and ran the second instance of SQL Developer for the first time, again without importing settings. In this instance of SQL Developer the NLS Parameters were populated with American and America.
    When the first instance of SQL Developer was the checked under these OS settings the NLS Parameters were still English and United Kingdom.
    I was not aware this was the case and, if my test is correct, it seems to contradict the SQL Developer user guide http://download.oracle.com/docs/cd/E10405_01/doc/appdev.120/e10406/intro.htm#CHDBHCAG
    James
    Message was edited by: Jampat to include SQL Developer version number.

  • CRITICAL: Insert View Objects Batch and Immediate mode

    In order to display the telephone and fax in 3 text inputs instead of one , I added transient attributes to my entity object, and added the corresponding code in the EntityImpl.java
    Scode, Acode and Number
    For each of their set functions, do something like:
    public void setScode(Number value)
    String tel_old = (String)getAttributeInternal(TEL);
    //Then split tel into three parts (probably by '-'...)
    //Update the part you want
    //Mash the parts together again, getting 'tel_new'
    setAttributeInternal(TEL, tel_new);
    setAttributeInternal(SCODE, value);
    I have a code similar to this, when i execute in batch mode it is working fine, But When i execute in "Immediate Mode" It fails. How to rectify this ?
    Should I tranfer the set and get codes to the ViewObjectRowImpl.java file. Currently the ViewRowImpl.java is default , nothing is modified in it.
    Thanks a lot.

    Problem Solved. The order of the GetAttribute and setAttribute was significant in Immediate mode. I am still not sure how the particular order can be changed.
    Areacode attribute was called before Statecode attribute.
    Cheers.

  • Any Recent Anti-glare buyers can share their Views against Retina and Performance/Battery

    Can some one Share their Recent Purchase of MBP or Retina MBP Performance, Battery Life, Anti-glare!!

    I have the rMBP. Performance is incredible, especially with app launching. Power button to desktop takes about 12 seconds, and 90% of app launches happen within one "Dock bounce" (official unit of time in OS X ). These are the sort of things you notice, as opposed to CPU clock speeds. Very happy with the performance.
    Battery life is great. It's about 5–6 hours if you just leave things as is, but if you grab gfxCardStatus, you can force the system to use the Intel HD 4000, which is a very capable graphics chip as is, and this'll get you 8–10 hours of regular use (backed up by Ars). And it'll run noticeably cooler.
    Speaking of cooler, the rMBP generally runs warm under normal usage. It can get a bit toasty, especially if you kick in the nVidia chip. It doesn't get painful unless you're running some hard games; the fans can get loud as well. They sound like white noise, but you can definitely hear it.
    Glare is still present, but you can look past the glare and still see what you're doing most of the time (unless the content is very dark to begin with). You can get the display bright enough to cope with almost everything except direct sunlight. Also, the Facetime HD camera shows rainbows on the screen of my iPhone when I hold the phone up to the camera. I see the same rainbows through polarized sunglasses, which means that the camera lens, or quite possibly the display glass itself is polarized. But don't hold me to that—just an observation.
    @webv555: Boot Camp doesn't support automatic graphics switching—you're on the hungry nVidia chip the whole time.
    Hope this helps!

  • How to access View object programmatically and ...

    Hi,
    I have a hypothetical situation. I have for example a VO based on Emp and a data table in the UI with a button.
    When pressing this button I want to call a method that will programmatically read in teh values of the current row and then update a field in the UI (say an outputText).
    My problem is I am not sure where to pu this logic. I thought I shouldI create a new method in the Application module then bind that methid to the button. By having the code in the AM then it can easily access the VO attributes. But how can the method in the AM access the values in my backing bean and set them or read them ?
    I am not sure where to put the code - I could put it in teh backing bean and call teh application module from there but the manual doesn't really recommend that I think.

    This is probably logic that should be in the backing bean in a method that is activated from your button.
    The ADF Developer Guide shows you how to do it here:
    http://download.oracle.com/docs/html/B25947_01/bcservices005.htm#sthref681

  • ADF table and ADF form on the same view object

    Hi,
    As per the ADF demos available on ADF site, I created a jsf page with 2 panels. One panel is an ADF table based on a view object. And the other panel is and ADF form based on the same view object. My requirement is that as I scroll through the records in the ADF table, the ADF Form should dynamically display the details of the record in the ADF table. My understanding is that this should be automatic. However, its not working as expected. What have I missed?

    Hi,
    Apply PPR for form that displays details.
    Like :
    <af:table id="t3">
    </af:table>
    <af:panelFormLayout id="pfl2" partialTriggers="t3">
    </af:panelFormLayout >

  • Issues in persisting dynamic entity and view objects using MDS

    Hi All,
    I'm trying to create dynamic entity and view objects per user session and to persist these objects throughout the session, I'm trying to use MDS configurations(either file or Database) in adf-config.xml.
    I'm facing following two errors while trying to run the app module:
    1. MDS error (MetadataNotFoundException): MDS-00013: no metadata found for metadata object "/model/DynamicEntityGenModuleOperations.xml"
    2. oracle.mds.exception.ReadOnlyStoreException: MDS-01273: The operation on the resource /sessiondef/dynamic/DynamicDeptEntityDef.xml failed because source metadata store mapped to the namespace / DEFAULT is read only.
    I've gone through the following links which talks about the cause of the issue, but still can't figure out the issue in the code or the config file. Please help if, someone has faced a similar issue.
    [http://docs.oracle.com/cd/E28271_01/doc.1111/e25450/mds_trouble.htm#BABIAGBG |http://docs.oracle.com/cd/E28271_01/doc.1111/e25450/mds_trouble.htm#BABIAGBG ]
    [http://docs.oracle.com/cd/E16162_01/core.1112/e22506/chapter_mds_messages.htm|http://docs.oracle.com/cd/E16162_01/core.1112/e22506/chapter_mds_messages.htm]
    Attached is the code for dynamic entity/view object generation and corresponding adf-config.xml used.
    ///////////App Module Implementation Class/////////////////////////
    public class DynamicEntityGenModuleImpl extends ApplicationModuleImpl implements DynamicEntityGenModule {
    private static final String DYNAMIC_DETP_VO_INSTANCE = "DynamicDeptVO";
    * This is the default constructor (do not remove).
    public DynamicEntityGenModuleImpl() {
    public ViewObjectImpl getDepartmentsView1() {
    return (ViewObjectImpl) findViewObject("DynamicDeptVO");
    public void buildDynamicDeptComp() {
    ViewObject internalDynamicVO = findViewObject(DYNAMIC_DETP_VO_INSTANCE);
    if (internalDynamicVO != null) {
    System.out.println("OK VO exists, return Defn- " + internalDynamicVO.getDefFullName());
    return;
    EntityDefImpl deptEntDef = buildDeptEntitySessionDef();
    ViewDefImpl viewDef = buildDeptViewSessionDef(deptEntDef);
    addViewToPdefApplicationModule(viewDef);
    private EntityDefImpl buildDeptEntitySessionDef() {
    try {
    EntityDefImpl entDef = new EntityDefImpl(oracle.jbo.server.EntityDefImpl.DEF_SCOPE_SESSION, "DynamicDeptEntityDef");
    entDef.setFullName(entDef.getBasePackage() + ".dynamic." + entDef.getName());
    entDef.setName(entDef.getName());
    System.out.println("Application Module Path name: " + getDefFullName());
    System.out.println("EntDef :" + entDef.getFileName() + " : " + entDef.getBasePackage() + ".dynamic." + entDef.getName());
    entDef.setAliasName(entDef.getName());
    entDef.setSource("DEPT");
    entDef.setSourceType("table");
    entDef.addAttribute("ID", "ID", Integer.class, true, false, true);
    entDef.addAttribute("Name", "NAME", String.class, false, false, true);
    entDef.addAttribute("Location", "LOCATION", Integer.class, false, false, true);
    entDef.resolveDefObject();
    entDef.registerSessionDefObject();
    entDef.writeXMLContents();
    entDef.saveXMLContents();
    return entDef;
    } catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    return null;
    private ViewDefImpl buildDeptViewSessionDef(EntityDefImpl entityDef) {
    try {
    ViewDefImpl viewDef = new oracle.jbo.server.ViewDefImpl(oracle.jbo.server.ViewDefImpl.DEF_SCOPE_SESSION, "DynamicDeptViewDef");
    viewDef.setFullName(viewDef.getBasePackage() + ".dynamic." + viewDef.getName());
    System.out.println("ViewDef :" + viewDef.getFileName());
    viewDef.setUseGlueCode(false);
    viewDef.setIterMode(RowIterator.ITER_MODE_LAST_PAGE_FULL);
    viewDef.setBindingStyle(SQLBuilder.BINDING_STYLE_ORACLE_NAME);
    viewDef.setSelectClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT);
    viewDef.setFromClauseFlags(ViewDefImpl.CLAUSE_GENERATE_RT);
    viewDef.addEntityUsage("DynamicDeptUsage", entityDef.getFullName(), false, false);
    viewDef.addAllEntityAttributes("DynamicDeptUsage");
    viewDef.resolveDefObject();
    viewDef.registerSessionDefObject();
    viewDef.writeXMLContents();
    viewDef.saveXMLContents();
    return viewDef;
    } catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    return null;
    private void addViewToPdefApplicationModule(ViewDefImpl viewDef) {
    oracle.jbo.server.PDefApplicationModule pDefAM = oracle.jbo.server.PDefApplicationModule.findDefObject(getDefFullName());
    if (pDefAM == null) {
    pDefAM = new oracle.jbo.server.PDefApplicationModule();
    pDefAM.setFullName(getDefFullName());
    pDefAM.setEditable(true);
    pDefAM.createViewObject(DYNAMIC_DETP_VO_INSTANCE, viewDef.getFullName());
    pDefAM.applyPersonalization(this);
    pDefAM.writeXMLContents();
    pDefAM.saveXMLContents();
    ////////adf-config.xml//////////////////////
    <?xml version="1.0" encoding="windows-1252" ?>
    <adf-config xmlns="http://xmlns.oracle.com/adf/config" xmlns:config="http://xmlns.oracle.com/bc4j/configuration" xmlns:adf="http://xmlns.oracle.com/adf/config/properties"
    xmlns:sec="http://xmlns.oracle.com/adf/security/config">
    <adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">
    <defaults useBindVarsForViewCriteriaLiterals="true"/>
    <startup>
    <amconfig-overrides>
    <config:Database jbo.locking.mode="optimistic"/>
    </amconfig-overrides>
    </startup>
    </adf-adfm-config>
    <adf:adf-properties-child xmlns="http://xmlns.oracle.com/adf/config/properties">
    <adf-property name="adfAppUID" value="TestDynamicEC-8827"/>
    </adf:adf-properties-child>
    <sec:adf-security-child xmlns="http://xmlns.oracle.com/adf/security/config">
    <CredentialStoreContext credentialStoreClass="oracle.adf.share.security.providers.jps.CSFCredentialStore" credentialStoreLocation="../../src/META-INF/jps-config.xml"/>
    </sec:adf-security-child>
    <persistence-config>
    <metadata-namespaces>
    <namespace metadata-store-usage="mdsRepos" path="/sessiondef/"/>
    <namespace path="/model/" metadata-store-usage="mdsRepos"/>
    </metadata-namespaces>
    <metadata-store-usages>
    <metadata-store-usage default-cust-store="true" deploy-target="true" id="mdsRepos">
    <metadata-store class-name="oracle.mds.persistence.stores.file.FileMetadataStore">
    <property name="metadata-path" value="/tmp"/>
    <!-- <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
    <property name="jndi-datasource" value="jdbc/TestDynamicEC"/>
    <property name="repository-name" value="TestDynamicEC"/>
    <property name="jdbc-userid" value="adfmay28"/>
    <property name="jdbc-password" value="adfmay28"/>
    <property name="jdbc-url" value="jdbc:oracle:thin:@localhost:1521:XE"/>-->
    </metadata-store>
    </metadata-store-usage>
    </metadata-store-usages>
    </persistence-config>
    </adf-config>
    //////////////////////////////////////////////////////////////////////////////////////////////////////////

    Hi Frank,
    I m trying to save entity and view object xml by calling writeXMLContents() and saveXMLContents() so that these objects can be retrieved using the xmls later on.
    These methods internally use MDS configuration in adf-config.xml, which is creating the issue.
    Please share your thoughts on resolving this or if, there is any other way of creating dynamic entity/view objects for db tables created at runtime.
    Nik

  • [SOLVED] Multiple Dynamic View Objects and View Links - ADF Tree Table

    Hi all,
    I've got a method that creates 3 dynamic viewobjects using this:
                ViewDefImpl Level1ViewDef = new ViewDefImpl("Level1View");
                Level1ViewDef.addViewAttribute("LevelDescription","LEVEL1_DESCRIPTION",String.class);
                Level1ViewDef.addViewAttribute("SetOfBooksId","SET_OF_BOOKS_ID",Number.class);
                Level1ViewDef.addViewAttribute("CodeCombinationId","CODE_COMBINATION_ID",Number.class);
                Level1ViewDef.addViewAttribute("Level1","LEVEL1",String.class);
                Level1ViewDef.addViewAttribute("AccountType","ACCOUNT_TYPE",String.class);
                Level1ViewDef.addViewAttribute("PeriodYear","PERIOD_YEAR",Number.class);
                Level1ViewDef.addViewAttribute("PeriodNum","PERIOD_NUM",Number.class);
                Level1ViewDef.addViewAttribute("PeriodName","PERIOD_NAME",String.class);
                Level1ViewDef.addViewAttribute("PtdActual","PTD_ACTUAL",Number.class);
                Level1ViewDef.addViewAttribute("YtdActual","YTD_ACTUAL",Number.class);
                Level1ViewDef.addViewAttribute("LtdActual","LTD_ACTUAL",Number.class);
                Level1ViewDef.addViewAttribute("BudgetName","BUDGET_NAME",String.class);
                Level1ViewDef.addViewAttribute("BudgetVersionId","BUDGET_VERSION_ID",Number.class);
                Level1ViewDef.addViewAttribute("PtdBudget","PTD_BUDGET",Number.class);
                Level1ViewDef.addViewAttribute("YtdBudget","YTD_BUDGET",Number.class);
                Level1ViewDef.addViewAttribute("LtdBudget","LTD_BUDGET",Number.class);
                Level1ViewDef.addViewAttribute("EncumbranceType","ENCUMBRANCE_TYPE",String.class);
                Level1ViewDef.addViewAttribute("EncumbranceTypeId","ENCUMBRANCE_TYPE_ID",Number.class);
                Level1ViewDef.addViewAttribute("PtdCommitment","PTD_COMMITMENT",Number.class);
                Level1ViewDef.addViewAttribute("YtdCommitment","YTD_COMMITMENT",Number.class);
                Level1ViewDef.addViewAttribute("LtdCommitment","LTD_COMMITMENT",Number.class);
                Level1ViewDef.setQuery(sql_level1);
                Level1ViewDef.setFullSql(true);
                Level1ViewDef.setBindingStyle(SQLBuilder.BINDING_STYLE_ORACLE_NAME);
                Level1ViewDef.resolveDefObject();
                Level1ViewDef.registerDefObject();
                ViewObject vo1 = createViewObject("Level1View",Level1ViewDef);I can create the view objects fine and create a single viewlink between two of them, however i'm getting problems with 2 view links.
    This is how I'm creating a view link:
                ViewLink Level2Level1FKLink = createViewLinkBetweenViewObjects("Level2Level1FKLink1",
                                                        "Level2View",
                                                        vo1,
                                                        new AttributeDef[]{
                                                          vo1.findAttributeDef("Level1")
                                                        vo2,
                                                        new AttributeDef[]{
                                                          vo2.findAttributeDef("Level1")
                                                        "LEVEL1 = :Bind_Level1");
                ViewLink Level3Level2FKLink = createViewLinkBetweenViewObjects("Level3Level2FKLink1",
                                                        "Level3View",
                                                        vo2,
                                                        new AttributeDef[]{
                                                          vo2.findAttributeDef("Level2")
                                                        vo3,
                                                        new AttributeDef[]{
                                                          vo3.findAttributeDef("Level2")
                                                        "LEVEL2 = :Bind_Level2");I can get the data to display on an adf tree table if i'm only using a single view link, but when i try and implement 2 view link (for 3 levels on the adf tree table) i'm getting problems displaying the data.
    I'm getting the following error:
    Aug 10, 2007 2:44:39 PM oracle.adfinternal.view.faces.renderkit.core.xhtml.PanelPartialRootRenderer encodeAll
    SEVERE: Error during partial-page rendering
    oracle.jbo.NoDefException: JBO-25058: Definition Level3View of type Attribute not found in Level2View_Level2Level1FKLink1_Level2ViewThe thing is, Level3View isn't in the Level2Level1FKLink viewlink.
    I've been reading about something similar here
    BC4J Master-Detail-Detail
    but I am still unsure of what the problem is.
    Thanks in advance.

    I found the answer here:
    http://radio.weblogs.com/0118231/stories/2004/06/10/correctlyImplementingMultilevelDynamicMasterDetail.html

  • Problem with 2 View Objects based on One Entity -Probably a Bug in ADF BC

    Hi
    I am using JDeveloper 10.1.3(SU5) and adf faces and ADF BC and to explain my problem I use HR schema.
    First, I created 2 view objects based on countries table named as TestView1 and TestView2. I set TestView1 query where clause to region_id=1 and TestView2 query where clause to region_id!=1 in the view object editor and then I created 2 separated form on these 2 view objects by dragging and dropping from data control palette.
    Now when I insert a record in the form based on TestView1 with region_id set to 1 and commit the record and go to the next form I can see the record in the second form which is completely wrong since it is against the where clause statement of the second form.
    I am really confused and the situation is very wired and it seems to me something like bug in adf bc.Am I right.Is there any work around or solution for solving this problem.
    Any help would be highly appreciated.
    Best Regards,
    Navid

    Dear Frank,
    Thank you very much for your quick response.
    Reading your helpful comments now I have some questions:
    1- I have commited the record in the database so shouldn't the query of view objects be re-queried?
    2- We try to use ClearVOCaches (entity_name,false) in afterCommit of the base entity object but unfortunately it does not work correctly. after that,We got root app module and used findViewObject method to find all the view of that entity (we have found them by using name not automaticlly) and called executeQuery of all views. From my point of view it has 2 big disadvantages. First suppose that this entity is an important entity and 4 or 5 viow objects are based on it. Now, For inserting one record we should re-execute 4 or 5 view which I think makes some performance issues. Besides, If during the development one programmer add a new view object based on this entity and don't add the executeQuery in the afterCommit for this view, again we have the same problem. Isn't there at least a way that automatically refresh all related view objects however the performance issue still exists.
    3- You mentioned that this issue is handled in the developer guide. Could you kindly give me a refrence which developer guide you mean and which section I should read to overcome this problem.(I have ADF Developer's Guide for Forms/4GL Developer's Guide , however I search for clearVOCaches and surprisingly nothing was found!!!)
    4- Could you please give me some hints that from your point of view what is the best method to solve this problem with minimum performance effect.
    Any comment would be of some great help.
    Thanks in advance,
    Navid

Maybe you are looking for

  • U2018Transaction type not relevant for asset postingu2019

    while using tcdoe f-58 down payment to vendor giving error message  u2018Transaction type not relevant for asset postingu2019

  • Clear by assignment field and customer

    Hello, I am facing the following situation: I am working on an interface SAP-Payment service provider.  This provider is sending me a total amount (sum of several invoices)in order to recognize every invoice separately, I asked to inform in the assig

  • Internal Logistics Invoice - IR before GR.

    Dear All, I trying to post an Internal Logisitcs Invoice (in Company B)  generated via INVOIC02 IDoc triggered from Billing document of Selling Company A before any Goods Receipt is posted in Company B but all Invoices are created with zero quantity

  • How to extract .SAR files

    Hi All Can anybody tell me how to extract .SAR files. Is it possible through sapcar.exe, if so how. Thanks in advance

  • Java on my computer

    Im having trouble trying to get this java programming program to work. It says you need a recent JDK version installed? If anyone know please help!!!!!!