Dive into Oracle ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 9:16:58 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:
 

Search BC4J JavaDoc:
 

May 2005
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Apr   Jun

Get Firefox!

Sunday, May 15, 2005

After watching my screencast, the customer I was working with to help build the quick demo for the Oracle Life Sciences User Group tomorrow was following my steps meticulously, but still running into an error at runtime. Everything about our environments was identical except one thing: he was using a production version of Oracle 10g version 10.1.0.2, and I happened to have an internal build of Oracle 10g version 10.2 on mine. Hating the thought that some minor niggle would prevent him from showcasing JDeveloper and ADF as part of his presentation, I again fired up my trusty Oracle Web Conferencing so he could show me the problem in his environment.

He was trying to execute the following query using an ADF view object, leveraging the Oracle 10g BLAST functionality of the Oracle Data Mining Option which help scientists analyze sequences of DNA and proteins for best matches...

select *  
 from TABLE(BLASTN_MATCH (
    :0, -- query_sequence (Zero-th VO Bind Variable)
     CURSOR(SELECT seq_id, seq_data FROM ecoli10), -- seqdb_cursor
       1, -- subsequence_from
      -1, -- subsequence_to
       0, -- FILTER_LOW_COMPLEXITY
       0, -- MASK_LOWER_CASE
      10, -- EXPECT_VALUE
       0, -- OPEN_GAP_COST
       0, -- EXTEND_GAP_COST
       0, -- MISMATCH_COST
       0, -- MATCH_REWARD
      11, -- WORD_SIZE
       0, -- X_DROPOFF
       0)) -- FINAL_X_DROPOFF
 t where t.score > 25

It turned out that the error he was getting at runtime was't related to ADF at all, but instead was an error from his database:

ORA-22905: cannot access rows from a non-nested table item

I set out to use a DOS shell on his machine over the Oracle Web Conference to see if I could reproduce at the SQL*Plus command line -- factoring ADF out of the picture. The BLASTN_MATCH() function is declared to return a type DMSYS.DMBMOS, which is defined to be a TABLE OF DMSYS.DMBMO objects. When we tried the same query without the bind variable, hard-coding a scalar string value into the query, it worked fine. Somehow, introducing the bind variable confused the 10.1 database so that its SQL parser no longer knew the function returned a table-typed expression. In my 10.2 database, both static and bind-variable versions worked without an error. I found Bug 4227553 which sounded relevant to the problem, relating to getting an ORA-22905 in similar circumstances, which indicated it was fixed in Oracle 10.2 and suggested that we add an explicit CAST() function into the query to avoid the error. We follow this suggestion and changed the query to look like this instead:

select *  
 from TABLE(CAST(BLASTN_MATCH (
    :0, -- query_sequence (Zero-th VO Bind Variable)
     CURSOR(SELECT seq_id, seq_data FROM ecoli10), -- seqdb_cursor
       1, -- subsequence_from
      -1, -- subsequence_to
       0, -- FILTER_LOW_COMPLEXITY
       0, -- MASK_LOWER_CASE
      10, -- EXPECT_VALUE
       0, -- OPEN_GAP_COST
       0, -- EXTEND_GAP_COST
       0, -- MISMATCH_COST
       0, -- MATCH_REWARD
      11, -- WORD_SIZE
       0, -- X_DROPOFF
       0) AS DMSYS.DMBMOS)) -- FINAL_X_DROPOFF
 t where t.score > 25

and we were back in business! One last little step we had to do was to connect as DMSYS and GRANT EXECUTE on the DMBMOS type to PUBLIC so that the SQL parser would allow us to refer to it in the CAST() statement when logged on as another user like SCOTT. After figuring out this database-level issue, the quick ADF application built following my screencast worked great and the show could go on tomorrow. I even got a adhoc, over-the-phone tutorial on protein sequences in the process!


4:10:57 PM    



Francesca writes in to ask:

How can I set the maxFetchSize in a ViewObject in JDev 10.1.2? In JDev 9.0.5.2 it was one of the properties of Tuning of the ViewObject. Where is the same in JDev 10.1.2?

As part of simplifying the View Object Tuning panel in JDeveloper 10.1.2, we removed the "Max Fetch Size" field, and now set it for you automatically based on the most common use cases for using this feature.

In 9.0.5.2 and before, typically "Max Fetch Size" would be set to -1 if you wanted your view object to retrieve (by default, lazily) all of its rows. You would set it to 1 if you wanted to retrieve a maximum of one row, for example, when you knew that your query would either identifiy a single row or no row, based on some unique attribute value. The last case was that you would set "Max Fetch Size" to 0 if you wanted your view object to never fetch any rows, and be used only for inserts. Only in very rare cases would "Max Fetch Size" be set to some number other than -1, 1, or 0.

So, we designed the new VO Tuning Panel around these three use cases so that now in the "Retrieve from the Database" group, if you select:

  • All Rows in Batches of [ NNN ]  then it will set Max Fetch Size to -1 for you in your view object's XML metadata.
  • At Most One Row then it will set Max Fetch Size to 1.
  • No Rows then it will set Max Fetch Size to 0

If you want to set Max Fetch Size to some other value like 35 for some reason, you now have to do this programmatically. As I mentioned, it's not something that you would typically do anyway, but now you understand where "Max Fetch Size" has gone.

 


3:39:30 PM    


© Copyright 2008 Steve Muench.