Ignoring cache - selecting directly from database

I have a scenario where several tables will be mapped using Toplink for the data access benefits, but will be updated ouside of the Toplink process. Obviously this behavior negates the beneift of caching in toplink and I need a reliable way to bypass the cache when selecting from these tables.
The only method I've found in my testing to overcome this problem is to select "Always Refresh" and "Disable Cache Hits" on the related entities in the Toplink Mapping Workbench. All other configurations, including setting the identity map size to 0 will return stale instances of these objects.
I've also tried invoking dontCheckCache() and setCacheUsage() on my query with the understanding, based on the API documentation, that the cache would be ignored for the query. In both cases the returned object was retrieved from the cache and not the database.
While the workbench solution will suffice for my purposes, I would like to know if there are other methods of ignoring the cache. Also, I'm curious about why the query methods I've mentioned don't seem to have any affect on the source of the resulting objects.
I am using Toplink v9.0.3

Using "Always Refresh" and "Disable Cache Hits" is probably the best method to ensure that no cached data is every returned from queries. If you are using optimistic locking you may also use "onlyRefreshCacheIfNewerVersion" in conjunction with these.
For the full/weak identity maps the size is only the default map size, it will grow as objects are added, so setting this to 0 will have no effect on what is cached, you could set the cache type to NoIdentityMap ("None") to achieve this, but usage of alwaysRefreshCache is a better way as is still preserves object identity.
The query options dontCheckCache() and setCacheUsage() are in-memory querying options, they effect how cache hits are obtained, but do not effect how the objects are cached or refreshed. To refresh objects at the query level use refreshIdentityMapResult() ("Refresh"). Using refresh at the query level should also meet your needs, and may be better than setting the alwaysRefreshCache option on the descriptor as then you can control which queries refresh and which can obtain cache hits. (for example you may want to query for employees to refresh, but allow the query for the 1-1 backreference for phone numbers to obtain a cache hit). For refresh queries you can also set the refresh cascade depth.

Similar Messages

  • Select data from DataBase

    Hi;
    I try to select data from DataBase, But I get the following error, Could anyone help? thanks.
    Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.
    OracleDriver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at Lookup.main(Lookup.java:12)
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class Lookup {
        public static void main(String[] args)
            throws SQLException, ClassNotFoundException {
            String dbUrl = "jdbc:oracle:thin:@augur.scms.waikato.ac.nz:1521:comp319";
            String user = "group029";
            String password = "group029";
            // Load the driver (registers itself)
            Class.forName("oracle.jdbc.driver.OracleDriver");
            Connection c = DriverManager.getConnection(dbUrl, user, password);
            Statement s = c.createStatement();
            //SQL code:
            ResultSet r =
                s.executeQuery("SELECT * " +"FROM movie");
         StringBuffer results= new StringBuffer();
            ResultSetMetaData metaData = r.getMetaData();
         int numberOfColumns = metaData.getColumnCount();
         for(int i=1; i<=numberOfColumns; i++)
             results.append(metaData.getColumnName(i)+"\t");
         results.append("\n");
         while (r.next()){
             for( int i=1; i <=numberOfColumns; i++)
              results.append(r.getObject(i)+"\t");
             results.append("\n");
         s.close();
    }

    It's a classpath problem. Either you mistyped the class name, or you don't have the class in your classpath. I think Oracle's drivers come in db12.zip or db12.jar or some such. Whatever that jar or zip file is, it has to be in your classpath, but it's not.
    Or it is in your classpath, but you're in an appserver context where the classloader that the container provides for your app uses something other than the classpath variable. For instance, in tomcat, the jar file would be uder webapps/yourApplication/WEB-INF/lib I think.

  • How to select rows from database like 10 to 20 etc

    Hi Experts,
    I want to select rows from database like row number 10 to row number 20.How could it be done?

    HI,
       First get the data into the INTERNAL TABLE from the FLAT FILE and read the internal table using the index.
        ex: 1) Read table ITAB index 10.
              2) Read table ITAB index 20.
    or use as said by  Srinivas Gurram, to get the range of records using where condition to the loop.
    <REMOVED BY MODERATOR>
    Edited by: Ravi Kumar on Jun 9, 2008 4:01 PM
    Edited by: Alvaro Tejada Galindo on Jun 9, 2008 3:16 PM

  • Caching data read from database

    I have a big performace problem in our J2EE application. We use jsp and servlets to process a request. Servlet gets the results from database which are stored in a vector of dataobjects and vector is stored in session. We display only 20 rows in jsp and provide page navigation to view more data by Next and Prev links. The problem is we want to store results in request object instead of session variable but then that data is not availabe for Next and Prev links. We don't want to do another search to view more data. Is there a way to cache the data so that while view more data by page navigation we don't need to hit database since request object would be cleared at that time. I am clueless. I hope I explained the problem properly. Any help on this would be highly appreciated

    You're not clueless, you said it yourself.
    To make info available over multiple requests, you need to use a session variable rather than the request.

  • Select data from database tables with high performance

    hi all,
    how to select data from different database tables with high performance.
    im using for all entries instead of inner joins, even though burden on data base tables is going very high ( 90 % in se30)
    hw to increase the performance.
    kindly, reply.
    thnks

    Also Check you are not using open sql much like distict order by group by , use abap techniques on internal table to acive the same.
    also Dont use select endselect.
    if possible use up to n rows claus....
    taht will limit the data base hits.
    also dont run select in siode any loops.
    i guess these are some of the trics oyu can use to avoid frequent DATA BASE HITS AND ABVOID THE DATA BASE LAOD.

  • Select trigger from database

    Hi,
    We use the command "select text from user_source where name = 'XXX';" to
    get the content of stored proceudure.
    I would like to know the command used to select the content of trigger instead.
    Appreciate your help.
    Thanks.

    Hi,
    Try this code. I think this will solve your problem. Spool the text to a file as it may be difficult for you to read from the SQL prompt.
    SPOOL <LOCATION OF THE FILE>
    set long 50000;
    set lines 1000;
    SELECT TRIGGER_BODY FROM USER_TRIGGERS WHERE TRIGGER_NAME='XXX';
    SET LINES 100;
    SPOOL OFF.
    Regards,
    Jaikanth V Garlapati.

  • I can't create Entity Data Model Class directly from database

    I have just installed odac beta (ODAC1120250Beta_EntityFramework) and Orace XE 11g for test.
    I have Visual Studio 2010 on Windows 7 32bit.
    The problem is that after updating odac I can't create ADO.NET Entity Data Model class. If I try, VS2010 wizard makes me choose if I want to generate from db or create an empty model. If I choose to generate from database, the next window disappers making me return to VS2010.
    The workaround is to create an empty model and then update model from database. In this way it works.
    Anybody has experimented the same?...
    Best regards
    Francesco

    A couple of things you could try:
    1. Install SP1 for Visual Studio 2010.
    2. Do you already have an Oracle connection created in server explorer? If not, try creating one and then create the model.

  • How to select value from database view with * in wher clause

    Hi ,
      I ahve a database view with some fields.
    Now my requirement is to serach a single row on the basis of process type.
    Process type can have values like ZBA,ZBC,ZBD,ZBE or similarly anything starting with ZB.
    Now i know that starting two letters will be ZB , but dont knwo the last letter.
    So how should i use select query for the same?
    Should i use like operator for the same?
    regards
    PG

    hi,
    u can use character '%'.sample code like this
    SELECT reltype
                 instid_a
                 catid_a
                 instid_b
                 FROM /dbm/ord_docflow
                 INTO TABLE it_link
                 FOR ALL ENTRIES IN it_pnwtyh
                 WHERE  instid_a  =  it_pnwtyh-instid_a AND
                 instid_b  LIKE 'QMSM%'  AND
                 typeid_a  = 'BUS2400'  AND
                 typeid_b  = 'BUS2400' AND
                 catid_a   = 'BO' AND
                 catid_b   = 'BO' AND
                 reltype   = 'VONA'.
    this is similar to using* while we fetch values from table.in the above code only i no QMSM rest values not sure,so used QMSM%

  • File direct from database to open/save, without tempfile

    Hello, everyone.
    I've got the file uploading to the database, and that is working most excellent.
    How do I get it to open/save immediately without first using CFFILE action="write" to save it to a server folder, first?
    I'm using the following code:
    <cfcontent variable="#getFile.contents#" reset="true"><!--- binary data for file, pulled from "varbinary(max)" --->
    <cfheader name="content-disposition" value="attachment;filename=#getFile.fileName#">
    <cfheader name="content-type" value="application/octet-stream">
    <cfoutput>#toString(getFile.contents)#</cfoutput>
    <cfabort>
    .. but all this does is open a dialogue asking the user to either open or save the CFM file calling it, but the .cfm is replaced with .ZIP.
    The files are not all going to be the same MIMEtype - some will be Word documents, some Excel documents, some PowerPoint documents, and some PDF documents.
    ^_^

    Filetypes that can be uploaded into the database are PDF, PPT, DOC/DOCX, and XLS/XLSX (PDF, PowerPoint, Word, Excel).  I am setting the MIMEtype by using a CFC I built that creates an array of extensions and the MIMEtypes they are associated with (for example, if the filename ends in .DOCX, the array returns a MIMEtype of "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; if the filename ends in .DOC, the array returns a MIMEtype of "application/msword"; if the filename ends in .PDF, the array returns a MIMEtype of "application/pdf".  The CFCONTENT tag is then set for that type.)
    This is an internal web app that cannot be accessed outside of this network.  Every computer that has access to it has Office 2007 installed, as well as Adobe Reader, so when given the option to open or save, the "open" is always associated with the proprietary application (.xls is always given an option for Microsoft Excel; .docx is always given an option for Microsoft Word; etc.)
    Theoretically, once the binary of the Excel/Word/PowerPoint/PDF file is stored in the database, I should be able to read that binary data, give it the CFCONTENT and CFHEADER tags that it needs, and it should download and save, or open in the native application (this much is working.)  What is confusing me is why the applications feel that the files are corrupted and need to be recovered.  The file is being insert as binary, being retrieved as binary.  What _could_ cause the data to be misconstrued as corrupted?  I'm _not_ using TRIM for insert or select, or any kind of encoding/decoding.
    ^_^

  • Select double * from database table?

    Hi,
    See the entries in the following database table.
    TABLE1
    F1 -- F2 -- F3 -- F4 -- F5 etc..,
    AB   12    de    effd    32e
    CD   34    fr      wref   45fr
    EF   34    rfr      wfrf    wfwrf
    Here I need to get the two values of F1 field. Those are AB and CD into two separate variables.
    How can get these two values in to two variables with out DECLARING INTERNAL TABLE and with ONE SELECT QUERY?
    --Naveen Inuganti.

    Hi ,
    Check the code , it will resolve the issue --
    DATA : w_variable2 TYPE scarr-carrid,
           w_variable1 TYPE scarr-carrid .
    SELECT carrid UP TO 2 ROWS FROM scarr
    INTO w_variable2 .
      MOVE w_variable2 TO w_variable1.
    ENDSELECT.
    WRITE : w_variable1, w_variable2.
    From  your reference I created single silect query without internel table - -
    DATA : w_variable2 TYPE dbtable-f1,
           w_variable1 TYPE dbtable-f1 .
    SELECT F1 UP TO 2 ROWS FROM dbtable
    INTO w_variable2 .
      MOVE w_variable2 TO w_variable1.
    ENDSELECT.
    WRITE : w_variable1, w_variable2.
    Regards
    Pinaki

  • Select data from database via XML

    I want to select data for display and insert data to tables via XML, and I want
    to do this from a browser.
    I am using "Oracle8i Enterprise Edition Release 8.1.7.4.0" on HP-UX server
    with "JServer Release 8.1.7.4.0.".
    The oracle documentation says I need the following in order to do this.
    1. XML-SQL Utility
    2. XML Parser for Java, V2
    3. JDBC driver
    4. JDK
    5. A Java compliant web server
    6. XSL Servlet
    How do I verify, if the above software list is available in my environment.
    What are all available within the database and what are other software I need to
    install.
    Thanks
    Pushparaj

    It's a classpath problem. Either you mistyped the class name, or you don't have the class in your classpath. I think Oracle's drivers come in db12.zip or db12.jar or some such. Whatever that jar or zip file is, it has to be in your classpath, but it's not.
    Or it is in your classpath, but you're in an appserver context where the classloader that the container provides for your app uses something other than the classpath variable. For instance, in tomcat, the jar file would be uder webapps/yourApplication/WEB-INF/lib I think.

  • Select record from database table

    how to select a record from data-base table for current month in module-pool, i.e if current month is august then records selected should between 1/08/10 to 31/08/10.
    And, i also want to select records for last month i.e if current month is august then records selected should be between 1/07/10 to 31/07/10.
    And one thing more, it should work for every scenario. Like for months are changing then it should work according to that.
    Example: If month changes to October then current month ll be October and last month ll become September.
    Plz help me out.
    Moderator message: you chose a better forum this time, but the question is still too basic to be asked here, please (re)search yourself first, these forums are not catering to beginners.
    locked by: Thomas Zloch on Aug 8, 2010 9:41 PM

    Hi Nishant,
    You can use the option <b>ORDER BY </b> in your SELECT clause.
    This is the SAP Documentation for <b>ORDER BY </b> option.
    <i>Variant 1</i>
    <b>...ORDER BY PRIMARY KEY</b>
    <b>Effect</b>
    Sorts the selected lines in ascending order by the primary key of the database table. This variant is only permitted for SELECT * ....
    <i>Notes</i>
    Since views do not have a primary key, specifying ORDER BY PRIMARY KEY only makes sense with database tables. If, however, you do specify ORDER BY PRIMARY KEY with a view, all fields of the view are sorted in ascending order.
    <i>Variant 2</i>
    <b>ORDER BY f1 ... fn</b>
    <i>Effect</i>
    Sorts the selected records in ascending order by the specified column references f1 ... fn. If a list is also specified in the SELECT clause, the column references f1, ..., fn must appear in this list.
    By supplementing the statement with DESCENDING, you can sort in descending order using any of the fields f1, ..., fn.
    The default sort sequence is ascending order, but you can make this explicit by adding the addition ASCENDING.
    Consider this code this will select the latest 10 records form DB table(Note can use <b>Variant 2</b> for DB tables also.
    REPORT zarun_1.
    DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.
    START-OF-SELECTION.
      SELECT * FROM mara
                INTO TABLE it_mara
                <b>UP TO 10 ROWS                "No of rows you need(give 1 here)
               ORDER BY matnr DESCENDING.    "Specify the Key Fields here.</b>
      LOOP AT it_mara.
        WRITE : / it_mara-matnr,
                  it_mara-mtart.
      ENDLOOP.
    Regards,
    Arun Sambargi.
    Message was edited by: Arun Sambargi

  • Populate the JSP's select box from database on jsp load

    hai all,
    can any one help me in knowing how to populate the select box of a jsp
    with data from the database?
    thanks and regards,
    ravikiran

    <%
    String sQuery = "select id,Name from tablename";
    rs = stmt.executeQuery(sQuery);
    %>
    <select name="sltName">
    <%
    while(rs.next()){
    String sId = rs.getString(1);
    String sName = rs.getString(2);
    %>
    <option value="<%=sId %>" > <%=sName %> </option>
    <%
    %>
    </select>

  • Select user_id from database

    hi,
    i create a trigger in data base,when i do this :
    select user_id into nb
    from dba_users
    where username = ora_login_user;
    ORA-00942: Table ou vue inexistante

    Within PL/SQL (barring invoker's rights stored procedures), privileges that have been granted via roles are not available. Assuming you have been granted the DBA role, your access to DBA_USERS is most likely available only via a role. You would need to have the permission (i.e. SELECT ANY DICTIONARY) granted directly to the owner of the trigger.
    Justin

  • Access table directly from database in BO 4.0 WebI Report without using Universe

    Can i use the table avilable in database directly to make BO 4.0 WebI Report without create any universe. 
    I realy appeiciate your help.
    Thank you in advance.

    You need to create a universe for Relational SQL databases. Universe is a must. The reason you create universe is for the end users. WebI is designed for end users to create their own reports. It is a self service reporting tool. In order to do that, you need universe which allows users to query database using SQL without knowing SQL language.
    If you don't want to create a universe for reporting then you can use Crystal Reports instead of WebI

Maybe you are looking for

  • Problem with 4:3 resolutions in Widescreen

    Hello. My problem is this, I have a notebook dell with an intel x3100 and widescreen. I have the driver xf86-video-intel and everything works just fine, except for this little thing. I have some games that only work with 4:3 resolution, and I want th

  • ICloud upload

    How do I upload documents to iCloud using Lion 10.7.5 if no Move To or Upload action options are visible?

  • Reading jms message

    how to read the data from jms message, any articles / ideas please direct me.

  • .java - UML Class Diagram

    Hello for my university exam, i developed an application, now i need to print the UML class diagram, so I was searching around for a tool to create the class diagram for my source code. I had tryed the software "borland together trial edition" for ec

  • OES on VMWARE issue, disabled CPU

    This has happened twice in as many weeks. We have a 4 node OES Cluster doing file shares. The server goes offline and the only mention in the VMWARE side is an event that states "The CPU has been disabled by the guest operating system" . If you reboo