Two View Objects & One Entity Object

Has anyone ever had it where they create a row from a view object, set some attributes, insert it into that view object, and it shows up in another view object (as well as the one the row was actually inserted on)? Both of these view objects are using the same single entity object, it's just that their where clauses are slightly different. When I do a commit and then executeQuery, all is good and the new row only shows up in the intended view object.
Here is the code in my app module to do a row insertion on one of the view objects.
public void addQCNote(int userID, Number theStudyID, String theNote)
               //StudyFtsViewObjImpl freeTextVO = getStudyFtsViewObj();
               StudyFtsQCOnlyViewObjImpl freeTextVO = getStudyFtsReadOnlyViewObj();
               freeTextVO.setWhereClauseParam(0, theStudyID);
               DBSequence freeTextTypeCode = null;
               StudyFTSQCCodeValueViewObjImpl freeTextCodeValue = getStudyFTSCodeValueViewObj();
               Row[] freeTextCodeValueCurrentRowArray = freeTextCodeValue.getAllRowsInRange();
               // There SHOULD only be one ... but if there is more, pick one - geeez.
               for (int i = 0; i < freeTextCodeValueCurrentRowArray.length; i++)
                    Row currentFTRow = freeTextCodeValueCurrentRowArray[0];
                    freeTextTypeCode = ((DBSequence) (currentFTRow.getAttribute(StudyFTSQCCodeValueViewObjRowImpl.CODEVALUE1)));
               Row freeTextRow = freeTextVO.createRow();
               // Sets up default values for insertion into db at commit time
               freeTextRow.setAttribute(StudyFtsQCOnlyViewObjRowImpl.PARENTENTITYID, theStudyID);
               freeTextRow.setAttribute(StudyFtsQCOnlyViewObjRowImpl.PARENTENTITYNAME, "STUDY");
               freeTextRow.setAttribute(StudyFtsQCOnlyViewObjRowImpl.FREETEXT, theNote);
               freeTextRow.setAttribute(StudyFtsQCOnlyViewObjRowImpl.FREETEXTTYPECD, freeTextTypeCode);
               freeTextRow.setAttribute(StudyFtsQCOnlyViewObjRowImpl.CREATEDID, new Number(userID));
          catch (Exception ex)
               System.out.println("Exception in AR3MainAppModule.addQCNote: " + ex.toString());

Did you read this?
Re: Row created in one ViewObject added to all VOs based on the same Entity
Why don't you search this forum before posting?

Similar Messages

  • Two views on one entity

    I am using ADF. I have one entity with one attribute called Attr. I´ve created two view objects on this entity. Let´s name them v1 and v2 and there row objects v1row and v2row
    When I execute v1row.setAttr and commit the transaction the call to v2row.getAttr returns the original value and not the new one. In my opinion this happens due to the caching mechanism.
    How can notify all views that there underlying entity has changed?

    I implemented two changes:
    1. Disabled database trigger
    2. replaced validate/postchanges with commit
    myAm = getNotificationImplApplicationModule();
    Test1ViewImpl v1 = myAm.getTest1View1();
    Test1View2Impl v2 = myAm.getTest1View2();
    Test1ViewRowImpl v1row;
    Test1View2RowImpl v2row;
    System.out.println("executeQuery for both views");
    System.out.println("table has exactly one row");
    System.out.println("navigate to first row of view 1");
    v1row = (Test1ViewRowImpl)v1.getCurrentRow();
    System.out.println("V1, before setVt1:" + v1row.getVt1());
    v1row.setVt1("changed text through v1");
    System.out.println("V1, after setVt1:" + v1row.getVt1());
    System.out.println("commit changes to database");
    System.out.println("navigate to first row of view 2 without requery");
    v2row = (Test1View2RowImpl)v2.getCurrentRow();
    System.out.println("V2 without requery:" + v2row.getVt1());
    System.out.println("now requery view 2 and navigate to first row");
    v2row = (Test1View2RowImpl)v2.getCurrentRow();
    System.out.println("V2 with requery:" + v2row.getVt1());
    The result now is:
    04/07/26 10:24:20 executeQuery for both views
    04/07/26 10:24:20 table has exactly one row
    04/07/26 10:24:22 navigate to first row of view 1
    04/07/26 10:24:23 V1, before setVt1:initial text in database
    04/07/26 10:24:24 V1, after setVt1:changed text through v1
    04/07/26 10:24:24 commit changes to database
    04/07/26 10:24:25 navigate to first row of view 2 without requery
    04/07/26 10:24:26 V2 without requery:initial text in database
    04/07/26 10:24:29 now requery view 2 and navigate to first row
    04/07/26 10:24:53 V2 with requery:changed text through v1
    As you can see view 2 still gives the initial value without requery.

  • 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 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 worst, I will have to use the view link method to get the job accomplished, but it would be "cooler" if this would work!

    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!

  • Creating Views on multiple entity-objects

    Dear Forum,
    Is it possible to make associations and lookups based on multiple entity-objects.
    I made a custom view, say view1 based on two entity-objects, say entity1 and entity2.
    I used some fields from entity1 and some from entity2. There's a 1 to 1 association between the index of entity1 and entity2.
    Now I want to make a master-detail between entity1 and view1. I tried to make links and associations, but that didn't work.
    Any ideas?
    Kind regards,

    I am a bit confused by what it is you need. It appears you may have Entity Object and View Objects mixed up. Entity Objects are one-to-one with database tables. So, for every table one Entity Object, and the other way around. Associations are, pretty much, one-to-one with foreign keys on the database. So, if two tables have a foreign key between them, the two Entity Objects will have an Association between them. In that respect, Entity Objects and Associations are usually 'strictly defined' by the database model.
    The layer of View Objects and View Links is where you 'get design control' in the Business Components arena. A View Object can be based on zero, one or more Entity Objects. Viewlink, defining 'Master-Detail' relationships between View Objects (and NOT Entity Objects!!) can but don't have to be based on Entity Associations (i.e. foreign keys), but can be based on any attribute in the 'Master' view to any attribute in the 'Detail' view.
    In this respect, your statement that you want to "make a master-detail between entity1 and view1" makes no sense. It sounds like you need to create a View2, and then make a View Link between View1 and View2.
    Kind regards,
    Peter Ebell
    JHeadstart Team

  • Set two views in one portal page

    Hello all,
    I need to set two views in one portal page, or  tow deferent views have to be setted in one view, unfortunately i didn't find anythings in SAP forums about this subject
    please help me to reso

    Are you saying you have two separate WD Applications (both FPM) which you want to run as two iViews in the same Portal Page?  If so, this is a very basic NetWeaver Portal capability - to add more than one iView to a Page.  However this isn't the correct forum to discuss this, as that discussion would belong in the NetWeaver Portal Forum.

  • Uix two view-objects on one entity-object synchronize

    Hi All
    I want to add some uix pages to an old project using ADF UIX and Business Components.
    I have an entity object to a table witch about 50 fields.
    Now I create two view objects due to a better performance. One witch seven attributes for the overwiew and one with all attributes for the detail page.
    They are related via a view link.
    I create the overview as a read-only-table and the detail-page as an input-form.
    The proplem is that the synchronization don't work. The detail page shows the first dataset ever.
    Has anyone a solution or a tip where I can found that?
    Is where a performance problem if I use one view-object for both pages?
    Thanks in advance

    Use custom DataAction for the first page:
    package controller;
    import oracle.adf.controller.struts.actions.DataAction;
    import oracle.adf.controller.struts.actions.DataActionContext;
    public class Class1 extends DataAction
      protected void validateModelUpdates(DataActionContext actionContext)
          // put you custom validation here
    Message was edited by:
    Message was edited by:

  • Information from two views in one report

    I posted a thread earlier but I think I was little amibiguous about my problem and posted too much info. on the background of the problem maybe I can clarify.
    I have a report on a view TRK_CALLS_VIEW. This is dblinked to a table. Columns include
    Here is my region source code:
    ( STATUS = 'Open' and :P2_REPORT_SEARCH is null )
    ( regexp_like( USER_ || '#' || ASSIGNED_TO || '#' || PROBLEM || '#' ||
    SOLUTION || '#' || STATUS, :P2_REPORT_SEARCH, 'i' ) )
    I want to include columns from another view in the report. TRK_USER_VIEW.
    Columns include:
    User_ from TRK_CALLS_VIEW contains the same number as id in TRK_USER_VIEW.
    How would I add this to my existing code and have the names corespond to the correct id

    so in the above code you can see that both the webb.TRK_CALLS_VIEW and webb.TRK_USER_VIEW have some column that are named the same. eg/ "USER_","id". That is fine as SQL has provided a means to uniquely identify the columns. When you join these two views together and try to select or reference either the USER_ or id column without specifying which view you want to get the information from then that creates ambiguity and the compiler does not know if you want the USER_ form view 1 or view 2 and thus there is an error.
    To solve this issue we need to use . (dot) notation to specify the object (in this case view) which holds the column we want. We will also alias columns which share the same name. Here is how we would modify the above SQL statement:
    ------ View 1 ------
           tcv.ID          "TCV_ID", -- ID has been aliased to a unique name.
    ------ View 2 -------
           "TUV_ID", -- ID has been aliased to a unique name.
    -- also i used the alias tcv and tuv so that i could refer to the views by just using the alias rather than the lengthy view name.
    FROM webb.TRK_CALLS_VIEW tcv,
         webb.TRK_USER_VIEW tuv
    -- This is where we JOIN the views on a key value. In this case USER_.
    -- Always make sure your joins are the first portion of your where clause.
    WHERE tcv.USER_ = tuv.USER_
    -- I have explicetly referenced the view i want the column to come from by putting
    -- "tcv." infront of each column name. This tells the compiler to use TRK_CALLS_VIEW
      AND ( tcv.STATUS = 'Open' and :P2_REPORT_SEARCH is null )
       OR ( regexp_like( tcv.USER_ || '#' || tcv.ASSIGNED_TO || '#' || tcv.PROBLEM || '#' ||
          tcv.SOLUTION || '#' || tcv.STATUS, :P2_REPORT_SEARCH, 'i' ) )
    Edited by: Tyson Jouglet on Oct 8, 2008 9:10 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Two View objects with one Entity object

    I have such a requirement that, I need to take some mandatory attributes of one table in one page and the remaining in following page. After clicking Submit in the second page, i need to insert data in to the table.
    How to proceed with this ? When i click on next button of first page it is validating for all mandatory fields.

    Use custom DataAction for the first page:
    package controller;
    import oracle.adf.controller.struts.actions.DataAction;
    import oracle.adf.controller.struts.actions.DataActionContext;
    public class Class1 extends DataAction
      protected void validateModelUpdates(DataActionContext actionContext)
          // put you custom validation here
    Message was edited by:
    Message was edited by:

  • How to use view objects in entity impls?

    I would like to access a view object to implement business logic
    in an entity impl class method. How can this be done? More
    precisely I would of course like to do this in the context of
    the "current" Application Module the Entity "lives" in. I think
    this has to be possible because you can use a list validator for
    an entity objects attribute, which gets it's data out of a view
    Any help would be very welcome!

    Just to make things clear, View Objects access Entity Objects
    and you should implement your busines logic in the entity
    objects. This is the way BC4J was designed. It allows for
    reuse of your components and build different views (View
    Objects) ontop of Entity Objects.
    View objects do query the database and populate the entity
    objects. However, it is from the cached data in the entity
    objects where DML occurs (insert, update, delete). You want to
    put your validation at this level because you do not want to
    make a trip to the database if it does not validate.
    I recommend reading a whitepaper on J2EE development and
    BC4J. The URL
    Happy Reading!
    I would like to access a view object to implement business logic
    in an entity impl class method. How can this be done? More
    precisely I would of course like to do this in the context of
    the "current" Application Module the Entity "lives" in. I think
    this has to be possible because you can use a list validator for
    an entity objects attribute, which gets it's data out of a view
    Any help would be very welcome!

  • Use of Entity object

    Hi Everyone,
    I am totally new to using JDeveloper and the ADF Framework.The following is my Environment setup :-
    1] Oracle8i Enterprise Edition Release - Production
    2] JDeveloper
    Need ur help in answering my following queries :-
    1] Is it possible to access the Entity object directly from a calling class and execute the INSERT, UPDATE and DELETE operations ? In either of the cases, please let me know how it can be done, preferably with some sample code.
    2] Can I used the View object without Entity object for retrieving data from the database ? Please help me with some sample code if possible.
    Thanks in advance.

    Detail Rule, copy attribute value form master.
    In DetailEOImpl:
    protected void create(AttributeList 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();
    // 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)) {
    I call this method in the remove method of the detailEOImpl:
    public void remove()
    To set the flag I added follwoing code in the create method of the DetailEOImpl:
    protected void create(AttributeList attributeList)
    **** ADDED ***
    Number masterHasDetailsFlag = getRetrieveFromMaster().getHasDetailsFlag();
    if (!masterHasDetailsFlag.equals(Constants.NUMBER_YES)) {
    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
    PS All variable/method/class names have been manually renamed in this code so some small syntax problems may exist.

  • How to create entity object (Business Component) using service interface

    I have tried to create one entity object (ADF Business Component) in JDeveloper 11g using service interface option instead of database schema but getting Failed to read service WSDL URL: http://....?wsdl message.
    I have tried with axis default service Admin & Version wsdl and got same error message.

    +"Oracle ADF Business Components application modules offer built-in support for web services and for publishing rows of view object data as service data objects (SDOs). This means that you can use an application module both as a local component and as a remotely accessible service, thereby using the same component to support interactive web user interfaces and web service clients. Entity objects that you create in your local Business Components project can utilize SDOs that the service-enabled application module exposes on its service interface."+
    This means that you don't use Axis services but ADF Business Components Services. I am not sure this functionality made it in Boxer, but surely will in the next

  • Validate an entity object 'later'...

    Hi All,
    does anybody know if it is possible to partially validate an entity object or to validate it only when issuing a commit?
    I have the following problem:
    1. One entity object (and so one view object)
    2. Six pages each displaying different attributes of that view object
    3. On many pages there are required fields...
    4. When submitting the first page, the errors go on and on about the required fields on the 'other' (later) pages...
    Is there a way to work around this?
    Thanks for all your help...

    I had the same problem.
    I solved my problem overridden the datapage´s class' method: protected void validateModelUpdates(DataActionContext actionContext)
    I made a empty implementation of this method and, I didn´t overridden this method in the last page.
    I wish that this help.

  • Problem to give default value in entity object using query

    i have one entity object and i want to set default value of attribute like division which is based on employee code.
    entity object based on table leavedetail and using refrence table employee_hdr(empcode ,division).
    so how can i set default value of division attribute which is based on empcode attribute using SQL

    yes user, fetish nailed correctly.
    make some viewlink.
    something like says as example.
    department vo
    employee vo
    make viewlinks between those vo's
    important thing: exposed then source and destination accesor.
    use groovy :
    go to employee vo - create Department name field ( as transiest)
    use this statement default value expersion type.
    it will get the value. check over.
    so this example well suits to your scenario.
    i hope this will helps you.
    well create is an video. to get the value using groovy.
    Edited by: ADF7 on Apr 14, 2012 5:46 AM

  • Best way to validate multiple entity objects with each other

    I have the following scenario.
    There is one entity object with the following fields.
    Start Date
    End Date
    My requirement is to validate the dates in the entity do not overlap.
    What is the best way to achieve the same.
    This validation should be fired when we commit, since the user should be allowed to change the dates freely between entities.(Validation should not kick off when the current row changes)

    For this to achieve there is a concept called Effective Dated Entity Objects in Oracle ADF.
    Official ADF Documentation:
    Some blogs to help you

  • Entity object track changes "Modified by"

    Hi Experts,
    I have a question about entity object track changes. I change enabled one entity object attribute to track change "Modified by".
    However whenever the DB changes occurs then the Modified column is updated, however the name is the database connection user name. How can i override that value during the record update. Do i need to set any DbTransaction.session environment variable to save that in the db/
    - t

    Sorry for the late reply,
    I tried this but no luck. Can anyone let me know how to change the entity history columns values like modified by user name. etc....
    - t

Maybe you are looking for