Filter rows in Entity Object Cache

Hi
Jeveloper version:Studio Edition Version 11.1.2.1.0
I have a table employees with columns employee_id, first_name, last_name, last_opr.
i have created entity object employees_eo. my entity cache should contain only rows which are not deleted(i.e last_opr not equal to 'D');
how do i achieve it.

I need to have only the rows which are not deleted(.e last_opr<>'D') in the entity object cache. (Not in the view object cache)
The reason why i need is: i have an alternate key in the entity object employees_eo with the combination of employee_id, department_id. it raises an error('already exists') when the same combination is found.
Lets say employee_id 100 with department_id 10 is deleted. Delete in the sense i am not deleting the record physically. Just flagging last_opr as 'D'.
When i am trying to add new record with employee_id 100 and department_id 10. it says 'already exists'.
so what i thought is , my entity object cache can contain only rows which are not deleted, so that alternate key will not check the deleted rows..

Similar Messages

  • How to get first row from View Object cache.

    hi,
    I am using Jdeveloper 11.1.1.6
    can we get first row from View Object cache??
    Thanks in Advance.
    Best
    Shashidhar

    Hi Frank,
    Thanks for reply!!
    My case is:
    I have a Query based ViewObject.
    One of the field is LOV and remaining fields are in ADF table. the LOV field is out side ADF table when i insert first record in ADF table and i choose LOV  filed the value is selected.
    when i create second row LOV value got refreshed because both are in same VO.
    I need to get the LOV value of first row and set same value to second Row.
    Shashidhar

  • Accessing all rows in Entity Object

    Hi All,
    I have a master-child relationship with ChildVO based on entity object. When user hits on save after making some changes, I would like to pass all rows in master view object and all fetched rows in entity object to a pl/sql api which takes pl/sql table datatypes. I would call this API in AM. So is there any way to access all entity rows of child view object?I tried to use view link accessors but it returns null. I can think of the following way:
    for each row in master view object
    loop
    set current row for master view object. This would execute child vo for that master row.
    then fetch all rows from child vo. populate pl/sql table
    move on to next master vo row.
    end loop;
    Drawback with above approach is that we would excute child object query for every master row. Is there any direct way to access rows in entity object in AM? Any pointers on this would be of great help.
    Thanks in advance,
    Murari

    "and all fetched rows in entity object"
    is not a correct statement to make, EO will always represent a single row of the database record.you will get all the fetched rows in the VO, not the EO.
    Tapash

  • Entity Object Caching!

    Hi I am trying to understand what kind of caching an entity object does. Suppose a user issues a query which returns X no of rows utilizing a view Object. If another user issues the same query, will it retrieve from the entity object or go to the database to find it?
    What do developers have to do in order to minimize visits to the database?
    null

    Hi
    My understanding is that the query will still be send to the database, the rows returned will be compared with those in the cache, and if they exist and have not been changed the cached objects will be used.
    To enable Oracle to prevent queries being submitted to the database the BC4J framework would have to support functionality similar to that provided by Oracle parallel server (and its support for distributed caches) determing whether data had been modified via distributed locks.
    I apologise if this is a bum steer, perhaps Development can comment...
    null

  • View all rows in Entity object

    please I have a problem can I one help me
    I want to get all rows from specific Entity object
    example
    I am now in validate method in XXX Entity Object and i want to get all the rows in XXX table from validate method(all rows)
    can any one help me to do that
    thanks in advance

    ya sire
    I want from validate method in EO XXX to validate all the rows in the table XXX
    so I want to get all the rows from validate methods in the EO XXX
    thanks in advance

  • Error while deleting a row from the Entity Object

    Hi OAF Guys,
    i am unable to delete the newly created row from the entity object.
    let me explain my scenario.
    1. i have a table of which some of the columns are mandatory.
    2. I am writing the code in the validateEntity to check wether the user really enter anything into the fields.
    3. My problem is, when the user creates row and wanted to delete the row without entering any details, the validate entity of the EO gets fired which will not allows to delete the row.
    Is there any workaround for this problem.
    Regards,
    Nagesh Manda.

    Hi Tapash,
    I am very sorry for not providing you the complete details of my scenario. Here i am explaining
    1. what code you have placed while creating the row and in validation method on EOImpl.
    while creating a new row i am initializing the primary key of the EO with the sequence value.
    2.When you say, you are unable to delete the row, are you getting a error message ? if yes, custom message or fwk error ?
    its not the fwk error, its the custom message which wrote in my validateEntity method of EO to check whether the user had entered all the necesary columns or not.
    3.How are you trying to delete the row ?
    while the user clicks on the delete switcher i am getting the primary key of the row and searching for the row in the vo and finally deleting it.
    The problem arises when the user creates a row, and later doesnt want to enter the details and delete it. Here while deleting the row the validateEntity method of the EO gets fired and doesnt allow me to do so :(.
    Any way appreciate your help tapash.
    Regards,
    Nagesh Manda.

  • Error while Insert new Row in Entity Base View Object

    Hi,
    can someone tell me the reason of following problem? :
    There is a Entity Base View object, which is Binded as ADF Table in a JSFX Page.
    I took the standard operations from the Control Panel: CreateInsert, Commit and Rollback.
    Places them a ADF Buttons.
    Whenever i am trying to insert a Row, after commit i am getting the ORA Error: ORA-01410: invalid ROWID.
    By the way: The Entity Object is using the RowID as Primary Key.
    When i press commit a second time, the the Row is inserted in the Database.
    Any Idea, how to workarround this ORA Error?
    Thank You!

    n by default if you had no pkconstrainst in db,
    in jdev default rowid as prim key.
    as john said make the key as proper.
    and do it.
    if you have db constrainst in db.
    it can be achived by dbconstrainstname with ora.
    what am saying dbconstranist name will map it ora.
    http://download.oracle.com/docs/cd/E21764_01/web.1111/b31974/bcadvgen.htm#BABEFGCI

  • How to add row in multiple view object based on common entity object.

    Hi ,
    I have
    Jdeveloper version - 10.1.3.3.0
    Oracle Database - 11g R2
    I have a situation where i have to show data from one table in three adf tables on jsf page depending on a flag value in a column in table. For this purpose i have done the following steps
    a) Created an entity object on the database table .
    b) Created three view objects on this entity object and edited the view object's SQL and included the where clause
                       WHERE  A.USER_PERSONAL_NO = :P_USER_PERSONAL_NO AND
                           A.AUTH_TYPE = 'LF'
                       The auth_type cloumn decided in which view object the data will be shown
    Now, when i query the data from database by executing the query of these view objects the data is shown correctly in all three view objects. Till here there seems every thing ok
    Now , i have to provide the logic to add records in the adf tables for this i have provided add button in action facet of all three tables which are binded to methods in managed bean,
    when i add a record in a adf table by add button the new row which is created is shown in all three tables . I cant understand why this is happening , please help me to solve this problem.
    How can i make it possible so that the record appears only in that adf table in which the record is added.
    The method for adding record is
                Row rw = currentAM.getWfRecommAuths().createRow();
                rw.setAttribute("UserPersonalNo",this.getQuery_personal_no().getValue());
                rw.setAttribute("AuthPersonalNo","");
                rw.setAttribute("AuthType","LX");
                currentAM.getWfRecommAuths().last();
                currentAM.getWfRecommAuths().insertRow(rw);
               Please help , thanks in advance.

    Hi,
    have a look at polymorphic view objects
    http://download.oracle.com/docs/cd/E21764_01/web.1111/b31974/bcadvvo.htm#CEGDCCCB
    Frank

  • Pushing committed rows in entity to all view objects

    I have a Entity object EO1. I have two view objects VO1 and VO2, both based on EO1.
    Assume User 1 and User 2 logged into the application.
    User 1 -> creates one row in VO1 and commits the data.
    User 2 -> he is viewing VO2, can he see the newly created (without re-executing the view object VO2). I mean the newly created row is pused to VO2 ? (is there any solution to resolve this?)

    check section <b> Implementing Database Update Notification Using ADF BC</b>
    in this book link:
    http://my.safaribooksonline.com/book/databases/oracle/9780071622547/active-data-services/ch20lev1sec5

  • Purpose of Entity / View caches

    From research, articles, testing, and what info I've been able to glean off forum and metalink, it appears that entity/view caches are not used to satisfy querying, but to minimize storage of redundant data in memory. In other words, the purpose of the cache is simply to minimize memory used, but does not help query performance in any way.
    Is this accurate? If this is the case, it would seem that minimizing caching in many cases might be better for performance than using a cache.
    I've asked about the naure of entity / view caching in a TAR -- over two weeks in, still no answer....
    B

    Brad,
    A fundamental design point of ADF Business Components is that we let the database be our global, cross-user shared cache. We make no attempt to try and be the global, shared cache in the middle tier very much by design. The application module defines the boundaries of the current users unit of work, and provides facilities for allowing that unit of work to span multiple HTTP requests with failover protection, etc.
    The alternative approach is to try and provide a global, shared cache in the middle-tier, and require the user to consciously clone objects that need to be modified, and then deal with the issues of keeping the global, shared cache up to date when users make changes. This incurs overhead to maintain the consistency of that global cache when users are pounding lots of changes into it. We consciously opted against this approach after studying the way that Oracle Applications applications worked with the database in a typical scenario. The AM's transaction, which holds the caches, is a cache of in-progress work by that user, which can optionally have some of its data kept around for the next client that will use that AM from the pool.
    The AM instances are pooled and used in a stateless way, but using an algorithm called "stateless with affinity" which attempts to keep an AM intance "sticky" to the client that used it last if load allows us to do that. This occurs when the user is performing a unit of work that spans pages, so that the AM is being released to the AM pool in the "Managed State" mode instead of the "Stateless" mode.
    During the span of that unit of work, a user might use the same LOV's and visit the same screens over and over in the act of completing the job. The caches allow that user to avoid requerying any of that data during the span of that transaction, and generally the caches will contain only the data that is relevant to that user's task at hand.
    In 10.1.2, you can use the RowQualifier to filter rows in memory for simple kinds of SQL-type predicates. In 10.1.3, we've added a lot more control for querying over the caches, filtering over the caches, and doing both -- under developer control -- over either or both the cache and the database.
    Today, the primary way that the cache comes into play is avoiding database queries when things like association traversal is performed (typically as a part of business logic inside entity objects that need to access related entities to consult properties or methods on them), finding an entity by primary key which is performed for various reasons I've outlined in this blog article...
    http://radio.weblogs.com/0118231/stories/2005/07/28/differenceBetweenViewObjectSelectAndEntityDoselectMethod.html
    ..., as well as avoiding requerying when you re-render view object data that's already been queried during the unit of work.
    The entity cache holds the entity instances that the user has queried into the application module instance's transaction. The entity cache is populated by virtue of a view object's SQL statement, or by a direct or indirect call to EntityDefImpl.findByPrimaryKey().
    That said, we do support the notion of a shared, read-mostly application module as well. To use a shared application module, you need to set the jbo.ampool.isuseexclusive configuration property to the value false.
    Since all users are sharing the same application module, in particular they are sharing the view object instance, and even more in particular, its default rowset's default iterator.
    At the present time, for this feature to work robustly, the client code must insure that each user iterating the rows in a view objects inside a shared AM instance creates his own RowSetIterator and does not rely upon using the default RowSetIterator. Failure to do this could result in users messing each other notion of "current row" up.
    If you read my article on OTN about VO Performance Tuning...
    http://www.oracle.com/technology/products/jdev/tips/muench/voperftips/index.html
    you'll see that by avoiding caching when not needed, in some situations you can improve performance.
    We hope to make the multi-user, shared-readonly data reading even simpler to take advantage of in the future for shared, read-only data, but it's possible to achieve today with a little work.

  • HOWTO: Expose Entity Object Methods to Clients

    By design, clients cannot directly access entity objects. The view object layer provides an extra layer of security--you can choose exactly what data and methods you want clients to see.
    This HOWTO describes the process of exposing an entity object method to client programs.
    First, if you don't already have one, you must base a view object on your entity object and add the view object to your data model. For full details of how to do this, see the help topics under
    +Developing Business Components
    --Working with View Objects, View Links, Application Modules, and Clients
    +----Creating and Modifying View Objects, View Links, Application Modules, and Clients
    For the purposes of this HOWTO, we'll assume that you already have an entity object, Employees, with a method on it, calculateBonus(),
    and a view object EmployeesView based on Employees.
    First, you must generate a view row class. A view row represents one row of the view object's cache; it corresponds to a view of a particular entity object.
    To generate a view row class:
    1. Right-click EmployeesView and choose Edit.
    2. In the View Object Editor, select the Java page.
    3. Select Generate Java File and Generate Accessors for the view row class.
    4. Click Done. This creates a class called EmployeesViewRowImpl.
    Next, you should add a "delegator" method to the view row class--a public method with the exact same signature as the entity method, that simply calls the entity method. For example:
    public int calculateBonus(int rating) {
    return getEmployees().calculateBonus(rating);
    Next, you should export this method.
    1. Right-click EmployeesView and choose Edit.
    2. In the View Object Editor, select the Client Row Methods page.
    3. Shuttle the method you just created into the Selected list and click Done.
    This creates an interface called EmployeesViewRow that contains your method.
    Now you can call the method from your client. You should cast the row returned by EmployeesView.current(), the <jbo:Row> tag, or a similar method or data tag to EmployeesViewRow.
    For example,
    <jbo:Row id="myRow" datasource="ds" action=Current>
    <% out.println(((EmployeesViewRow) myRow).calculateBonus(3)); %>
    </jbo:Row>
    null

    Hi Lisa,
    There's a difference between exporting methods (on an application module, view object, and view row--this is done on the "Client Methods" tab of the view object and application module wizards and the "Client Row Methods" tab of the view object wizard) and making an application module remotable (which is done on the "remote" tab of the application module wizard).
    You should always export methods you want clients to use--and you only need to do this on the application module if you've written methods on your application module (which I didn't in this HOWTO). You can still use these methods in local mode--the interfaces will be present locally. The advantage of exporting methods is that it doesn't lock you into local mode--you'll be able to change to remote mode later (if you decide that's the way to go) with minimal changes--because the interfaces will be present locally even when the implementation classes aren't.
    By contrast, you should only make an application module remotable if you're planning on deploying in a non-local configuration. You can do this step right before deployment.
    Hope this helps,
    Avrom
    null

  • Extended but NOT polymorphic Entity Object ?

    Hi,
    We are trying to implement the OO features of ADF BC, i.e : Inheritance and Polymorphism, to reuse the logic in EO. I need some confirmation below to make sure we apply it correctly :
    1) We can Extend Entity Object WITHOUT assigning any discriminator, can't we ?
    (this is what I call Extended but NOT polymorphic )
    If the answer is yes , then I have further question :
    2) In our Order Processing module of our ERP application, there are following entity object : SalesOrder, Invoice, SalesReturn, CreditNote
    And there are four underlying database tables : SalesOrder, Invoice, SalesReturn, CreditNote.
    They are surely DIFFERENT transaction BUT they have COMMON attributes (and validation), This is why I call it "Extended but NOT polymorphic".
    The common attributes are :
    - DocID (PK)
    - DocNumber
    - DocDate
    - Warehouse
    - Customer
    - Salesman
    - TermOfPayment
    - DueDate
    So I create one BaseOrderEntity as super class entity. Then I create four entity objects that extend the base entity :
    Entity : SalesOrder, Extend : BaseOrderEntity, Database Object : SalesOrder
    Entity : Invoice, Extend : BaseOrderEntity, Database Object : Invoice
    Entity : SalesReturn, Extend : BaseOrderEntity, Database Object : SalesReturn
    Entity : CreditNote, Extend : BaseOrderEntity, Database Object : CreditNote
    Is this the correct way to apply it ?
    In other word, is this the correct use case ?
    Thank you very much,
    xtanto.

    Starting in JDeveloper 10.1.2, the ADF runtime throws an error if it detects that you have a superclass and subclass entity objects without properly-configured discriminator attributes. If you do not intend to instantiate the superclass, just assign it a descriminator attribute with a value that will never occur in real-life, like NULL or 'x' or whatever.
    It will be simplest if all your family of subclasses were stored in the same table, although that is not required. It simply makes the polymorphic queries easier.
    If you want to avoid the runtime check for the discriminator's being properly configured, because you know that your application will never run the chance of loading the same row into the entity cache as two different entity definition types, then you can get a property jbo.abstract.base.check in your configuration (or as a System property) to the value false and then the check is not performed.

  • 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)
              try
                   //StudyFtsViewObjImpl freeTextVO = getStudyFtsViewObj();
                   StudyFtsQCOnlyViewObjImpl freeTextVO = getStudyFtsReadOnlyViewObj();
                   freeTextVO.setWhereClauseParam(0, theStudyID);
                   DBSequence freeTextTypeCode = null;
                   StudyFTSQCCodeValueViewObjImpl freeTextCodeValue = getStudyFTSCodeValueViewObj();
                   freeTextCodeValue.executeQuery();
                   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));
                   freeTextVO.insertRow(freeTextRow);
                   freeTextVO.setCurrentRow(freeTextRow);
              catch (Exception ex)
                   System.out.println("Exception in AR3MainAppModule.addQCNote: " + ex.toString());
    -brian

    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?
    Sascha

  • Problem while setting new value to entity object attribute in doDML meathod

    Hi all,
    I am overriding the entity objects doDML method for generating the value of Sequence Number just before insert .
    For this puropose i am using doDML method. I am fetching the maximum value for the sequence number feild from the table by a prepared statement
    and then incrementing that value by one.
        protected void doDML(int operation, TransactionEvent e) {
            if (operation == DML_INSERT) {
                // code for getting the max+1 of sequence number before insert
                //command executes.
                try {
                    System.out.println("Inside doDML Method");
                    String sql =
                        "select nvl(max(seq_no),0)+1  from WF_LEAVE_HDR where org_unit_code = " +
                        this.getOrgUnitCode();
                    PreparedStatement pstmt =
                        getDBTransaction().createPreparedStatement(sql, 0);
                    ResultSet rs = pstmt.executeQuery();
                    rs.next();
                    Integer newSeqNo =rs.getInt(1); //(Number)rs.getString(0);
                    //this.setSeqNo(new Number(newSeqNo));
                    setAttributeInternal("SeqNo",new Number(newSeqNo));
                    System.out.println("Value of new seq no is -->>"+getSeqNo());
                } catch (Exception excpt) {
                    System.out.println("Inside catch block ");
                    excpt.printStackTrace();
            super.doDML(operation, e);
        }i am getting the value correct by using the sql statement but while i am using setAttributeInternal("SeqNo",new Number(newSeqNo));
    it is giving an error and value for new sequence no is not passed to the seq no feild of the entity object. I have tried this.setSeqNo(new Number(newSeqNo))
    but it is also not wotrking .
    Any one please help , I am using Jdeveloper 10.1.3
    Thanks all in advance.

    iloveoracle,
    Sigh... in addition to doing this in doDML (which Dimitar points out is the wrong place to do this)... you are making a huge huge mistake.
    select nvl(max(seq_no),0)+1  from WF_LEAVE_HDRWhat happens when two people do this at around the same time? You don't do any locking, so you will get two rows with the same SeqNo. This is absolutely the wrong way of doing sequence numbers. The best way of doing this would be to use real sequence numbers (an Oracle sequence) and ignore the fact that there will be gaps. If you insist on using your approach, you MUST LOCK THE ENTIRE TABLE before you try to do your little max() + 1 trick, otherwise you run the very real risk of getting duplicate SeqNos. OK, I see that you are trying to do sequences by org_unit_code, so you don't have to lock the whole table, but you do have to have some way of holding a lock. You must also write some code to be able to handle an "unable to get the lock because someone else already holds it" type of situation.
    <rant>
    I have seen so many people try to do this little max() + 1 trick. It DOES NOT, WILL NOT work until you handle locking properly. One question that I often ask when I interview database developers is about generating "gapless" sequences; unless the job is for a brand-new-with-absolutely-no-experience trainee, answering "select max() + 1" without any mention of concurrency issues would be grounds for an immediate rejection of the candidate. Seriously. Have a run over to http://asktom.oracle.com and search for "gapless" if you'd like to see a more strongly worded rant.
    </rant>
    Bottom line, just use an Oracle sequence if it's at all possible; otherwise, be prepared to write some bunches of code to deal with locking.
    John

  • 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!

Maybe you are looking for