Read-Only view object won't give me it's row

Hi,
I have a read only view object which when executed has one row in it, but the next method returns null.
this is my code in the AM:
    public Row getPerson() {
        Row row = null;
        ViewObject vo = getPersonsView1();
        vo.setNamedWhereClauseParam("p_login_id", getUserPrincipalName());
        vo.executeQuery();
        System.out.println("rows:" + vo.getEstimatedRowCount());
        if (vo.hasNext())
           row = vo.next();
        return row;  
    }and the console log:
06/09/15 10:37:57 [513] select person_id,
login_id,
orig_system_id,
person_type,
title,
preferred_name,
preferred_name ||' '||surname full_name,
first_name,
other_names,
surname,
phone_work,
email_address
from sys_persons
where person_type = 'Staff'
and login_id = :p_login_id
06/09/15 10:37:57 [514] Bind params for ViewObject: PersonsView1
06/09/15 10:37:57 [515] Binding null of type 12 for "p_login_id"
06/09/15 10:37:57 [516] *** DCDataControl.sync() called from :DCBindingContainer.refresh
06/09/15 10:37:57 [517] *** DCDataControl.sync() called from :DCBindingContainer.refresh
06/09/15 10:37:57 [518] **** refreshControl() for BindingContainer :rft_ConsolePageDef
06/09/15 10:37:57 [519] *** DCDataControl.sync() called from :DCBindingContainer.refresh
06/09/15 10:37:57 [520] *** DCDataControl.sync() called from :DCBindingContainer.refresh
06/09/15 10:38:00 [521] Column count: 12
06/09/15 10:38:00 [522] ViewObject: PersonsView1 Reusing defined prepared Statement
06/09/15 10:38:00 [523] Bind params for ViewObject: PersonsView1
06/09/15 10:38:00 [524] Binding param "p_login_id": banstey
06/09/15 10:38:00 rows:1
Source breakpoint occurred at line 38 of SystemServiceImpl.java.Note above System.out.println("rows:" + vo.getEstimatedRowCount()); returns:
06/09/15 10:38:00 rows:1
but when i debug with a break point in the above method if (vo.hasNext()) returns false.
I have tried doing row = vo.next(); without the if statement, but row still evaluates to null.
The VO returns one record in the BC4J tester and I have this exact method and VO defined in another project and it works there. Tearing my hair out with this one...
Brenden

try RowSetIterator instead,
RowSetIterator it = vo.createRowSetIterator("myIt");
if(it.hasNext())
MyVORowImpl row = (MyVORowImpl)it.next()
//don't forget close the RowSetIterator
I guess you use the VO.next(), but the current row of the VO is the one you get from db, and his next is null...

Similar Messages

  • Partial read-only view object. How to make it work?

    Hello,
    is there a way to have a "partial" read-only view object, where some attributes are based on an EO and some others are extracted directly from a table with no corresponding EO?
    On this view-object it should be possible to perform row insertions from an af:table, in a way that, after validation (i.e. a row selection change), the values on the attributes not based on the EO do not get lost, even if they do not have any attributes based on an EO.
    On the other hand, if I use fake EO attributes ($none$) for those read-only attributes, their values will not gest lost after validation of the new interted rows, but in this case, when the table is first rendered on the page, the table shows empty values on those items, probably because the EO attributes are empty when the query is performed.
    Note that It seems I cannot use Transient attributes where their value is calculated with a SQL statement, since it would mean I would have to perform an heavy SQL statement for every transient attribute.
    Is there any other solution, I hope the problem is clear.

    That solution does not cover the case where an attributed of one entity used as reference is calculated from a SQL expression with parameters involving the remaining attributes of the same entity.
    For example consider a reference-only entity based on a table with one field T(COD). This entity has one more attribute other than COD itself, CALCULATED_VALUE.
    How can I bind the attribute CALCULATED_VALUE to a SQL expression which is a function of COD: MyDBPackage.GetValue(COD, :environment), where :environment is bind variable?
    The frameowork always give me JBO-exception , asking to specify IN or OUT for the variable.

  • Finding Application Module name in read-only view object classes

    Hi all,
    I have a fairly basic question about finding application module name when we are coding in ViewObject java classes.
    I want to know how can I obtain <<application module>> NAME that our current view object is contained in it at run-time. I think there should be a way to find current application module NAME, when we are in ViewObject classes including View Object, View Row or view object definition classes (I've overridden all mentioned classes).
    I should notify that since our view object is read-only I may not count on view object's entity classes, coz as you know a read-only view object don't have any entity in it!
    So, if you have any idea about finding current application module name in view object java classes please let me know.
    Appreciate for your replies,
    Nasser

    Thanks guy, it was helpful:)
    Now i can access application module name through viewObject classes.
    But another question is raised...sorry if i m boring:( I promise its the final question ;)
    Is there a way to get application module name in an extended version of JboException class?
    Thanks again for your reply:)
    Nasser

  • ADF View Criteria on a Read Only View Object

    Hi,
    I have created a read only view object using a query. The query consists of analytical functions to fetch the AVG values dynamically.
    So far my approach worked fine.
    I want the Average values in my query to be calculated dynamically based on the certain view criteria.
    But after applying view criteria, my query is formulated as shown below:
    SELECT * FROM (SELECT   RECEIVED_YEAR,
               WEEK_NO,
               NO_RECEIVED,
               NO_STARTED,
               ROUND (TO_NUMBER (REPLACE (AVG_HRS_TO_START, ':', '.')),2) AVG_HRS_TO_START,
               ROUND (AVG (TO_NUMBER (REPLACE (AVG_HRS_TO_START, ':', '.'))) OVER (ORDER BY RECEIVED_YEAR),2)              OVERALL_AVG_HRS,
               GOAL_HRS,
               ROUND (AVG (NO_STARTED) OVER (ORDER BY RECEIVED_YEAR), 2) AVG_NO_STARTED,
               ROUND (AVG (NO_RECEIVED) OVER (ORDER BY RECEIVED_YEAR), 2) AVG_NO_RECEIVED
               FROM ORDERS_RCPT_TO_START_VW
    ORDER BY RECEIVED_YEAR, WEEK_NO) QRSLT  WHERE ( ( ( ( (RECEIVED_YEAR = :RecdYear ) AND (WEEK_NO <= :weekNo ) ) ) ) )
    As per this query, it is calculating the Average values first and then applying filter criteria rather than applying the filter criteria and calculating average values.
    Please help me on this.

    Entity objects are used to update/delete/insert data to the database.
    If all your base DB object offers is read then just create a read only view object.

  • Adding/deleting rows from a treeTable with a read-only view object

    Hello --
    I'm getting a JBO-25016 error when I go to delete a row from a treeTable. I want to create the hierarchy from a stored procedure, have the user add and remove nodes without calling back to the database. I will iterate through the tree and see what has changed and made the necessary updates on the database manually.
    What is the correct method for adding/removing rows form the UI component?
    Thanks!
    Tom

    Thank you, Amit! That did the trick.
    Edited by: Tom on Apr 28, 2011 11:51 AM

  • Updatable view and Read only view

    Jdev version 11.1.1.6
    1. Can we use an updatable view instead of readonly view for LOVs?
    2. In my use case, I am having a panel-tabbed component. I create Region in the first tab & create Countries in the second tab. If I use a LOV for Regions based on the read-only view, then the data created & COMMITTED in the first tab is not getting reflected in the LOV in the second tab. But, if I use an updatable view for the Region field's LOV, then the LOV works fine. But, want to know if it is fine to use an updatable view for LOVs.

    Quotation from the developer guide
    >
    Best Practice: When you need to create a read-only view object for
    data lookup, you should use the entity-based view object and deselect
    the Updatable option in the Entity Objects page of the view object
    overview editor.
    >
    >
    View objects can either be related to underlying entity objects or not. When a view
    object is related to one or more underlying entity objects the default behavior supports
    creating new rows and modifying or removing queried rows. However, the update
    feature can be disabled by deselecting Updatable in the overview editor for the
    entity-based view object
    >
    So the answer for your first question is Yes

  • Get var from InputText based on a "read only view"

    Hi.
    I have build some read only views from DB.
    All my views are linked.And the Data of each View is shown with " selectOneChoice" or "inputText".
    So far so good.
    But now my 1.problem.
    How can I get the value of the inputText ( coordinates" lat , long ") in a var to use it with a google maps function like
    map.addOverlay(createMarker(new GLatLng(lat,long)))
    2. problem
    how can i change the readout value of the inputText from[i] 51,2456 to 51.2456 for example
    Hope for your help!
    Chris

    Hi,
    Yes, I'am talking about ViewObjects in ADF Business Components.
    Version view:
    ADF Business Components     10.1.3.41.57
    BPEL Designer     10.1.3.3.0 (Build 070615.0525)
    CVS Version     Internal to Oracle JDeveloper (client-only)
    Java(TM) Platform     1.5.0_06
    Oracle IDE     10.1.3.41.57
    Struts Modeler Version     10.1.3.41.57
    UML Modelers Version     10.1.3.41.57
    Versioning Support     10.1.3.41.57
    For UserInterface I'am using "Web Tier--->JSF--->JSF JSP
    I've got 5 read only views: Region, Country, City, Location and Koord ( including all coordinates of Location)
    Now I want to show a marker in googleMaps with these coordinates but it doesn't work.
    function load() {
    if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(51,6),1);
    var Lat;
    var Longi;
    here starts my problem
    map.addOverlay(createMarker(new GLatLng(Lat,Longi))) } }
    </script>
    <afh:body onload="load()" onunload="GUnload()">
    <af:messages/>
    <af:form id="frm">
    </input>
    <af:selectOneChoice id="navList1" autoSubmit="true"
    value="#{bindings.LolaRegionV1.inputValue}"
    label="#{bindings.LolaRegionV1.label}">
    <f:selectItems value="#{bindings.LolaRegionV1.items}"/>
    </af:selectOneChoice>
    <af:inputText value="#{bindings.LolaKoordV1Lat1.inputValue}"
    label="#{bindings.LolaKoordV1Lat1.label}"
    required="#{bindings.LolaKoordV1Lat1.mandatory}"
    columns="#{bindings.LolaKoordV1Lat1.displayWidth}"
    partialTriggers="navList4" id="input1">
    <af:validator binding="#{bindings.LolaKoordV1Lat1.validator}"/>
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.LolaKoordV1Lat1.format}"/>
    </af:inputText>
    <af:inputText value="#{bindings.LolaKoordV1Longi.inputValue}"
    label="#{bindings.LolaKoordV1Longi.label}"
    required="#{bindings.LolaKoordV1Longi.mandatory}"
    columns="#{bindings.LolaKoordV1Longi.displayWidth}"
    partialTriggers="navList4" id="input2">
    <af:validator binding="#{bindings.LolaKoordV1Longi.validator}"/>
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.LolaKoordV1Longi.format}"/>
    </af:inputText>
    </af:form>
    I cant'*t give out the value of Lat , Longi to show the Marker.But a simple example like
    var x;
    var y;
    x = "51";
    y = "6";
    map.addOverlay(createMarker(new GLatLng(x,y)))
    is running.
    Thank you for help!
    Christian
    Message was edited by:
    user585675
    Message was edited by:
    user585675

  • Read only view which has an ORDER BY clause

    Aim to create a read only view which has an ORDER BY clause
    Sample script
    CREATE TABLE tab1 (
    col1 VARCHAR2(3),
    col2 NUMBER
    INSERT INTO tab1(col1, col2) VALUES ('ccc', 30);
    INSERT INTO tab1(col1, col2) VALUES ('bbb', 20);
    INSERT INTO tab1(col1, col2) VALUES ('ddd', 40);
    INSERT INTO tab1(col1, col2) VALUES ('aaa', 10);
    COMMIT;
    -- To creat View
    CREATE OR REPLACE VIEW v_tab1
    AS
    SELECT
    col1,
    col2
    FROM
    tab1
    ORDER BY
    col1
    WITH READ ONLY;
    I get the following error
    WITH READ ONLY
    ERROR at line 10:
    ORA-00933: SQL command not properly ended
    When I comment out the ORDER BY clause, the view is created
    Pls let me know how I can create a read only view with ORDER BY clause

    Hi,
    take a look at the documentation for CREATE VIEW, there is a restriction:
    "You cannot specify the ORDER BY clause in the subquery if you also specify the subquery_restriction_clause."
    Wolfgang

  • TM Contention and Read Only Views - Toad

    I have a case where a select against a view that has the read only option caused TM contention. I realize that the TM can be fixed by indexing the unindexed foreign key which I plan to do. The user only has select privilege so the locking must have come from select for update, but when I checked the query it was a select against a read only view from Toad. Has anyone seen the case where Toad does a select for update behind the scenes which causes locking issues. I am thinking this must be the case otherwise I do not know how a select against a readonly view could hold a lock.

    user12191713 wrote:
    I have a case where a select against a view that has the read only option caused TM contention. I realize that the TM can be fixed by indexing the unindexed foreign key which I plan to do. The user only has select privilege so the locking must have come from select for update, but when I checked the query it was a select against a read only view from Toad. Has anyone seen the case where Toad does a select for update behind the scenes which causes locking issues. I am thinking this must be the case otherwise I do not know how a select against a readonly view could hold a lock.using sqlplus post the same SQL & results
    Handle:     user12191713
    Status Level:     Newbie
    Registered:     Aug 4, 2011
    Total Posts:     40
    Total Questions:     25 (19 unresolved)
    I extend to you my condolences; since you rarely get your questions answered here.

  • Read a view Object parameter value

    can anyone tell me how to read a View Object parameter value from inside a DODML()?
    Thanks

    Please help us to understand the use case better. Can you please details the scenario? Are you looking for the bind variable value used for querying ?

  • Read-only data objects

    What is the best way to ensure that data in the cache is not modified after it is placed in the cache? Is there a way to specify that objects are "read-only"?
    My cache clients should have the capability to read and write from/to the cache, but should not be able to modify (or overwrite) exisiting entries. They should just be able to read exisiting entries or add unique new entries.
    Thanks!

    Hello,
    You should be able to extend WrapperNamedCacheto achieve the behavior you want.
    An example close to what you want to do is ReadonlyNamedCache
    Thanks,
    -Dave
    Edited by: dcarrano on Dec 1, 2009 4:05 PM

  • Read-only view for XMLType data

    HI Gentlemen,
    When I execute my SQL statement:
    select extract(object_value,'/keytabs/keytab/@SN') SN from keytabs
    against a schema-based XMLType table from SQL*Plus I get normal response:
    EXTRACT(OBJECT_VALUE,'/KEYTABS/KEYTAB/@SN')
    S_KBV_GESCHLECHT
    S_VDX_KONTENART
    However, when I create a Fusion application with business components, and a custom view in the Model project with the SQL statement above,
    it yields:
    oracle.sql.OPAQUE@1623820.
    Attribute type is String, and query column is VARCHAR(255). There is no entity because the view is read-only.
    Can anyone help me how to directly query XMLType to display the contents?
    Thanks, regards
    Miklos HERBOLY

    Can you try:
    select cast(extract(object_value, '/keytabs/keytab/@SN') as varchar2(255)) SN
    from keytabsJohn

  • Possible?Multi-Entity View Object with one Entity Object that is Read-only.

    I know this sounds crazy, but I would like to create a multi-entity view object, where one entity object is based on a table in my application (we'll call it "Users", which basically stores the primary key for the person from the institutional people database), and the other table is a entity object based on a view of the institutional people database table (read only access), which we can call "People".
    I know that since no updates will be done to the People table, it really should be a read-only View Object, but I would lose the ability to sort on attributes like Last Name, Hire date, etc, since those would be transient attributes in my ViewObject for the Users. By having People as an entity object, I can then create a multi entity view object and have the ability to join Users to People and be able to sort on the above mentioned fields (like Last Name).
    The problem is that when I use the JDev (I'm currently using 10.1.2.1) AppModule BC4J tester, when I click on the multi-entity view object that I added to the AppModule it gives me an error:
    oracle.jbo.RowCreateException) JBO-25017: Error while creating a new entity row for People.
    ----- LEVEL 1: DETAIL 0 -----
    (java.lang.InstantiationException) null
    I have tried to change all the attributes to updateable in my entity object, but no create method, and I have tried to make them all read-only, but no effect, I get the same error (probably because the People view is read-only in my schema).
    Is there a way to change the entity object so that it will not try to create a new row when it runs the Tester? So that the multi entity view object behaves more like a view link, but gives me the added bonus of being able to sort on the Last Name column from the People table?
    Thanks for any help on this subject...at worst, I will have to use the view link method to get the job accomplished, but it would be "cooler" if this would work!
    Jeremy.

    Steve, thanks for your quick response to my question.
    To answer your questions, I was trying to create the Multi-entity View Object to give me more flexibility when working with my User table, and my People view. The flexibility I desired was that I would be able to sort my Users based on attributes in the People view. This is not possible when the there is only one Entity in my VO, and the People view data are all transient attributes, because they are not in the SQL statement.
    Ultimately, after working with one of my colleagues, we decided to use the approach that you mentioned by creating a read-only VO with the SQL query we want to display to the user (contains both User and People data fields), and then use a different ViewObject when performing other actions on the User Table (such as inserts/updates/deletes). By using the setWhereClauseParam() method in the handleLifeCycle() for the JSP page, we should be able to navigate between the different View Objects, so that the user does not see any difference.
    Thanks! Oh, and by the way, I have read your article you included before, and I have used it many times before to tune my View Objects! Thanks!

  • Problem with in-memory filtering: JBO-25016: View object is read only

    Hello,
    I have problem with implementation of Steve's Muench example #71 - Dropdown Lists in Table with Different Choices per Row.
    Source for the list is a read only view object.
    Invoking viewObject.findByViewCriteria throwing:
    javax.faces.el.EvaluationException: oracle.jbo.ReadOnlyViewObjectException: JBO-25016: View object ... is read only.
    What's wrong?
    Rado
    Error stack:
    Caused by: oracle.jbo.ReadOnlyViewObjectException: JBO-25016: View object ... is read only.
         at oracle.jbo.server.ViewDefImpl.newInstance(ViewDefImpl.java:991)
         at oracle.jbo.server.ViewObjectImpl.createInstance(ViewObjectImpl.java:2784)
         at oracle.jbo.server.QueryCollection.createRowWithEntities(QueryCollection.java:1271)
         at oracle.jbo.server.ViewRowSetImpl.createRowWithEntities(ViewRowSetImpl.java:1869)
         at oracle.jbo.server.ViewRowSetImpl.makeRowCopy(ViewRowSetImpl.java:1546)
         at oracle.jbo.server.ViewRowSetImpl.insertRowAtInternal(ViewRowSetImpl.java:1667)
         at oracle.jbo.server.ViewRowSetImpl.findByViewCriteria(ViewRowSetImpl.java:4126)
         at oracle.jbo.server.ViewObjectImpl.findByViewCriteria(ViewObjectImpl.java:7033)
    My code:
    public RowIterator selectDetails(String code) {
    ViewObject vo = getVO();
    if (!vo.isExecuted()) {
    vo.setQueryMode(ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES);
    vo.executeQuery();
    vo.last();
    vo.setQueryMode(ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
    ViewCriteria vc = vo.createViewCriteria();
    ViewCriteriaRow vcr = vc.createViewCriteriaRow();
    vcr.setAttribute("Code", "='"+code+"'");
    vc.add(vcr);
    vc.setCriteriaMode(ViewCriteria.CRITERIA_MODE_CACHE);
    return vo.findByViewCriteria(vc,-1,ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
    }

    check attribute settings of your VO...
    the attribute for wich you set view criteria must be set to queryable and updatable - always

  • ADF BC connection to SQL Server with parameterized variable for View Object

    Hi everyone
    I'm developing a BPM Application using Oracle BPM 11.1.1.5.0 and JDeveloper 11.1.1.5.0
    Following the thread from the link below, since this is a new topic, I decided to open a new thread.
    Re: ADF method call to fetch data from DB before the initiator page loads
    what I'm trying to do is to get a record from a database and show it to the user on the initiator UI using ADF BC and not the Database Adapter.
    I have been able to work with ADF BC and View Objects to get all the rows and show them to the user in a table.
    However, when I try to run the same query in the parameterized form to just return a single row, I hit a wall.
    In short, My problem is like this:
    I have an Application Module which has an entity object and a view object.
    My database is SQL Server 2008.
    when I try to create a new read only view object to return a single row I face the problem.
    The query I have in the query section of my View Object is like this:
    select *
    from dbo.Employee
    where EmployeeCode= 99which works fine.
    However when I define a bind variable, input_code for example, and change the query to the following it won't validate.
    select *
    from dbo.Employee
    where EmployeeCode= :input_codeIt just keeps saying
    >
    incorrect syntax near ":"
    >
    I don't know if this has to do with my DB not being Oracle or I'm doing something wrong.
    Can someone help me with this problem please?
    thanks in advance

    Hi
    This all seems complicated to me so I think my simplest way would be to use the java code in the aformentioned thread by Sudipto:
    public String getUserLogin() throws WorkflowException,
    BPMIdentityException,
    BPMUnsupportedAttributeException {
    String userId = "";
    IWorkflowServiceClient wfSvcClient;
    ITaskQueryService queryService;
    IWorkflowContext wfContext;
    // Get username of User Login
    String contextStr = ADFWorklistBeanUtil.getWorklistContextId();
    wfSvcClient = WorkflowService.getWorkflowServiceClient();
    queryService = wfSvcClient.getTaskQueryService();
    wfContext = queryService.getWorkflowContext(contextStr);
    userId = wfContext.getUser();
    return userId;
    } I don't know where and how I should put the code to be called when the view object loads though.
    I have created a class in the java class section of my view object which has two methods related to the bind variable input_empCode:
    getinput_empcode and setinput_empcode , as expected.
    however any code i try to put in those two would not be called at all!
    for example:
        public Integer getinput_empCode() {
            //return (Integer)getNamedWhereClauseParam("input_empCode");
            return 1444;
        }and
        public void setinput_empCode(Integer value) {
            //setNamedWhereClauseParam("input_empCode", value);
            setNamedWhereClauseParam("input_empCode", 666);
        }It just keeps filled with the values in the bind variable section.
    I don't know what I'm doing wrong here.
    would you show me the way?
    Thanks again

Maybe you are looking for