JPA -- Don't Maintain Cache

Hi,
Is it possible to specify for a NamedQuery (or NamedNativeQuery) that I don't want its results to go into the cache? Something like TopLink's:
<toplink:maintain-cache>false</toplink:maintain-cache>I have some queries which really don't need to store their results in the cache. I tried with:
q.setHint(TopLinkQueryHints.REFRESH, HintValues.FALSE);But the results still seem to go into the cache. So, apparently TopLink Essentials puts them in the cache the first time, but simply doesn't refresh them after the subsequent database fetches.

Thank you, James!
The trouble is that the cast to DatabaseQuery kills the portability. If I start doing such things, there won't be any point in switching to JPA. We could just go on using TopLink.
As for the property:
<property name="toplink.cache.type.[[[ENTITY]]]" value="NONE"/>the trouble is that it will turn off the caching for the entire entity. Instead, I just want to turn off the cache for certain batch queries.
I had a very similar problem with calling Stored Procedures from JPA. I was forced to do things like:
Query q = em.createNamedQuery("some_dummy_query");
EJBQuery eq = (EJBQuery)q;
ValueReadQuery vrq = new ValueReadQuery();
SQLCall c = new SQLCall("begin ####res := pkg.func(#inp); end;");
vrq.setCall(c);
eq.setDatabaseQuery(vrq);
q.setParameter("res", Long.valueOf(1));
q.setParameter("inp", Long.valueOf(2));
Object o = q.getSingleResult();
System.out.println(o + "    (" + o.getClass().getName() + ")");Very ugly stuff. Also, custom mappings are not available. For example, it's a pain to map an enum to a legacy database.
I'm beginning to think that we should wait for JPA v2 before we do the switch.
Thank you for your assistance.
Best regards,
Bisser

Similar Messages

  • Need to knw how to maintain cache settings for infoprovider in one go

    Hi,
    We are trying change the OLAP cache settings for the queries, as we know queries inherit the properties of InfoProvider so instead of changing for queries we need to change it for infoprovider. But we have 1000+ infoproviders, i want to know is there any way to change for all the infoproviders at one go"
    we have around 1100+ infoproviders in our BW system
    we would like to know what is the option to activate all the queries at
    a time
    Can you please let us know how to maintain the cache settings for all
    the infoproviders in one go
    and also like to know whether this will change the cache settings of
    the queries present now in the system
    Thanks & Regards,
    Syeda Nausheen Sulthana
    SAP BASIS | AtoS

    Hi Nausheen,
    You capture the steps that you do in changing the infocube properties in BDC.
    Create an upload file with all the cubes technical names and execute the BDC program in automated way.
    You can take help from ABAP expert in your team.
    Let me know, if you need more details.
    Thanks,
    Krishnan

  • Don not excute valide query on MS explorer if i don't clear cache manualy

    I have a report taht execute a query on a table.
    I have notice that on some pc the query is not valid and the browser view old value.
    After a lot of test i have clear manualy the explorer'cache of Microsoft explorer. And then the query resul are valid.
    There i a solution ??
    Thank's

    See Re: ApEx Development Team: tab clear cache - new feature? .
    Scott

  • Mac OS 10, Firefox 4.0.1 None of my extensions/add ons work anymore, I have done restart/clear cache/update addons-still zip. Should I go back to old vesion or can this be fixed?

    See the above, I just did the update to 4.0.1 and now no add on function including weather. I've done restart with ad on disabled (oxymoronic in this case) and no diff.

    Fixed! I needed to enable the add on bar via view-Tool Bars

  • I'm facing a lot of problem to get connected to 3G speed on my iPhone4 . And also I hardly get 2g speed . I'm done with all the checks as network reset , clearin cache n cookies even . Thus request to clear this heck of a issue

    Facing a lot of problem in connecting to 3G speed on my iphone4 . Done with all the checks as network reset and also done with clearing cache n cookies still the problem is same . I hardly get 2g speed even . Thus I request to help to fix this problem.

    Your code is absolutely unreadable - even if someone was willing to
    help, it's simply impossible. I do give you a few tips, though: If you
    understand your code (i.e. if it really is YOUR code), you should be
    able to realize that your minimum and maximum never get set (thus they
    are both 0) and your exam 3 is set with the wrong value. SEE where
    those should get set and figure out why they're not. Chances are you
    are doing something to them that makes one 'if' fail or you just
    erroneously assign a wrong variable!

  • Experiences on JPA persistence providers other than standard SAP's

    Hi developers,
    in this thread I would like to gather experiences from all those who have tried using JPA persistence providers other than SAP standard implementation in productive environments
    It would be very interesting if you could share you experiences, for instance with regards to:
    - advantages of a specific implementation
    - disadvantages (if any)
    - new features available (e.g. Lazy support for Lob and single-value relationships)
    - ease of transport (did you manage to somehow use the java dictionary DCs or what?)
    - ease of build (e.g. EclipseLink requires additional build plugins to be developed)
    - ease of overall setup: how long did it take to set the DI stuff up (SLD SC creation/track creation/check-in/check-out/activate/transport/...)?
    thank you so much for sharing your experiences.
    Regards
    Vincenzo

    Hi Vincenco,
    yes, semantic IDs do not have a place in JPA. Semantic keys are needed, but not as IDs.
    Both SAP JPA and EclipseLink use @GenerationType.TABLE generation if you define @GenerationType.AUTO. ("AUTO" just means that the persistence provider "should pick an appropriate strategy for the particular database" (javadoc)
    Both TABLE and SEQUENCE are somewhat automatic.
    I guess the fact of lost-values is because the fetching of IDs is done in another transaction (probably for performance reasons, not to have the sequence table as a bottle neck).
    On Oracle, the combination of allocationSize on JPA side and INCREMENT BY / CACHE on Database side is as follows: allocationSize must be equal to INCREMENT BY, but JPA uses the intermediate numbers (which is not the case in normal (PL)SQL programming. There is no annotation-JPA-pendant to CACHE. But that JPA uses the intermediate numbers from memory may be considered as a JPA way of sequence caching (that may be further improved by Sequence CACHE for really big mass insers in one transaction).
    CACHE>1 will give you lost values even with allocationSize = Increment BY = 1.
    On the other hand, allocationSize=1 may give bad performance on mass inserts because the JPA provider must ask the database for every instance. allocationSize>1 (e.g. 20) is better but will again yield lost values. (But who cares with "long"?)
    There is one important issue with both automated value creation strategies - GeneratorType.TABLE and GeneratorType.SEQUENCE: The ID cannot be set by yourself on instantiation of an Entity object. JPA spec defines that the ID is set at the latest on EntityManager.flush or EntityManager.commit, which is sometimes too late if you have container managed transaction boundaries.
    But both SAP JPA and EclipseLink assure that the ID with Table and Sequence is set already after call EntityManager.persist(newObject). This improves a lot, but may be not enough.
    Example:
    @Entity(name="T_ORDER")
    public class Order {
         @OneToMany(targetEntity=OrderItem.class, mappedBy="order", cascade=CascadeType.ALL)
         private List<OrderItem> items = new ArrayList<OrderItem>();
         public void addItem (OrderItem item) {
              this.items.add(item);
              item.setOrder(this);
    @Entity(name="T_ORDERITEM")
    public class OrderItem {
         @ManyToOne(targetEntity = Order.class)
         private Order order;
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    Order o = new Order();
    OrderItem i1 = new OrderItem();
    o.addItem(i1);
    em.persist(o);
    OrderItem i2 = new OrderItem();
    o.addItem(i2);
    At the end of this snippet, o and i1 have ID != null but i2 has ID==null. there is no way to "auto-persist" an object which gets into a relation to an already persisted object. i2 gets an ID!= null after flush or commit.
    This may be tricky if your business logic that adds items is "pojo" without acces to EntityManager or if you do not want to mess up your business logic with flushes.
    How to "broadcast" the  unique IDs of just inserted order items to the User Interface if they are not yet set in the last line of your SLSB?
    We switched to simple UUIDs that are generated on instanciation. long VARCHAR2s, but it works fine and is very common.
    Regards
    -Rolf

  • cache-query-results question

    I have another post for general descriptor tag information but I do have a specific question. In a project I am looking at I see:
    <cache-usage> check cache by primary key </cache-usage>
    <cache-query-results>false</cache-query-results>
    <maintain-cache>true</maintain-cache>
    I'm not sure how to interpret this. Does this mean that a cache is in place or not? cache-query-rests is set to false which implies no caching, yet the other parameters imply a cache is in place. What overrides here?
    Thanks

    The XML maps directly to the API so the JavaDocs and related documentation are the best tools:
    cache-usage: query.setCacheUsage(int)
    This option indicates how the object cache should be used when processing the query. This is how in-memory query is configured as well as support for cache-hits on ReadObjectQuery.
    cache-query-result: query.setShouldCacheQueryResults(boolean)
    This option allows you to indicate that the results returned from the query execution should be held. When the query is executed again these results will be returned without going to the database or searching the object cache. This is just caching the results locally within the query.
    maintain-cache: query.maintainCache() or query.dontMaintainCache()
    This setting determines if the results returned from the query should be cached in the shared object cache. It is on by default and turning this off is very rare. Occasionally done to compare the cache version with the database verision when handling an optimistic locking failure.
    Doug

  • Data Caching in a Clustered Environment

              I want to cache read-only reference/code table data that will run in a clustered
              WLS6 environment. It's a JSP application and I am storing a complete HTML Select
              Control per reference/code table data in the cache. The question is where to
              cache it? I was going to put it in the ServletContext (JSP "application" implicit
              object), but the ServletContext is not replicated. I considered using JNDI, but
              there are problems with duplicate name errors when another server who doesn't
              originally bind the object tries to lookup, change and rebind the object. I guess
              JMS Multicasting is an option, but I don't want to implement JMS just for an application
              data cache.
              Any suggestions for a simple reference/code table read-only caching strategy that
              will work in a clustered WLS6 environment?
              

    If the data is strictly read-only, and you do not have to worry about cache
              integrity, then look at WebLogic JSP cachetag:
              http://www.weblogic.com/docs51/classdocs/API_jsp.html#cachetag
              You can use it to cache both the output and the calculations results
              (variables calculated inside the cache tag).
              The scenario will be exactly the same for non-clustered and clustered
              cases - using multicast to broadcast small invalidation messages (so the
              data can be refreshed from the database) is ok, but replicating application
              data is not (and you definitely do not want to use JNDI for this purpose).
              BTW, the initial CacheTag implementation in 5.1 (supposedly) had a 'cluster'
              scope and I assume it was multicasting fresh data after cache miss - there
              is no such scope in 6.0 implementation.
              If you still want replication you can look at javagroups:
              http://sourceforge.net/projects/javagroups/
              (distributedhashtable example).
              Olsen <[email protected]> wrote:
              > Cameron,
              > Thanks for the reply. However, as I stated below, I am not interested in
              > JMS, nor an EJB solution to the problem. It really is not that complicated of
              > a concept and I know a solution or two (ServletContext, JNDI), but none that works
              > in a WLS6 clustered environment.
              > Any other ideas???
              > Thanks...
              > "Cameron Purdy" <[email protected]> wrote:
              >>Dimitri had a clever (as ever) solution using JMS to maintain cache
              >>integrity:
              >>
              >>explanation at
              >>http://dima.dhs.org/misc/readOnlyUpdates.html
              >>
              >>d/l from
              >>http://dima.dhs.org/misc/readOnlyUpdates.jar
              >>
              >>--
              >>Cameron Purdy
              >>Tangosol, Inc.
              >>http://www.tangosol.com
              >>+1.617.623.5782
              >>WebLogic Consulting Available
              >>
              >>
              >>"Olsen" <[email protected]> wrote in message
              >>news:[email protected]...
              >>>
              >>> I want to cache read-only reference/code table data that will run in
              >>a
              >>clustered
              >>> WLS6 environment. It's a JSP application and I am storing a complete
              >>HTML
              >>Select
              >>> Control per reference/code table data in the cache. The question is
              >>where
              >>to
              >>> cache it? I was going to put it in the ServletContext (JSP "application"
              >>implicit
              >>> object), but the ServletContext is not replicated. I considered using
              >>JNDI, but
              >>> there are problems with duplicate name errors when another server who
              >>doesn't
              >>> originally bind the object tries to lookup, change and rebind the object.
              >>I guess
              >>> JMS Multicasting is an option, but I don't want to implement JMS just
              >>for
              >>an application
              >>> data cache.
              >>> Any suggestions for a simple reference/code table read-only caching
              >>strategy that
              >>> will work in a clustered WLS6 environment?
              >>
              >>
              Dimitri
              

  • Jpa backing store - what is the key [ newbie alert]

    If I use JPA for the coherence cache backing store, what in the JPA specifies the cache key for the object?
    Any code examples?

    Hi mesocyclone,
    the mapping of the primary key for the entity is done in the JPA-related mapping configuration of your entity you store in this cache. It is mentioned in the Wiki page you linked in:
    Entities may be mapped either by annotating the entity
    classes or by adding an orm.xml or other XML mapping
    file(s). See the JPA vendor documentation for more on
    how to map JPA entities.Two things to note however:
    1. You must not generate the primary keys by JPA, they must already be set in the cached value when they are put into the cache. This is required by Coherence so that the ownership mapping of the cached object to its owner Coherence node remains correct.
    2. Because of the previous, the JPA Entity Manager cannot decide from the id whether an object is supposed to exist in the database, or is supposed to be a new row with the assigned id. Therefore you must also somehow let JPA to know that a newly inserted entry will be an inserted row not an updated row. This is done in Hibernate with specifying an unsaved value indicated for a mandatory column with a special role (e.g. the version attribute) and initializing a newly created object to be cached later with that value in the respective attribute, but I don't know how it is done in JPA.
    Best regards,
    Robert

  • Is it possible to cache the updates of history, permissions, forms etc, and write them to disk only at exit?

    I noticed that Firefox updates instantly the places.sqlite database on disk, with every new page load.
    I suppose this is done to maintain the History complete in the event of a crash.
    The same thing happens with the permissions.sqlite and formhistory.sqilite.
    However this constant updating generates a lot of disk writes which may shorten the life span of SSD disks.
    Is it possible somehow to force Firefox to only update the various Profile databases at exit?
    Knowingly incurring the risk of data loss when crashes occur.
    I have disabled session restore and the recently closed tabs, among other things, so that's not the reason behind the constant updates.
    I am seeing this on a windows XP 32-bit, but it is probably the same on any system

    I suppose you could monitor those files. The add on SQL Lite manager allows you to open the databases of history. You could also clear history on end, or just browse in a private window all the time so it remembers nothing to save disk writes, but that is really silly. Please ignore that.
    I do not think there is a way to do that currently.

  • Where we maintain the cost of  characteristics  values in variant  conf.

    Hello guys,
      This thread i have posted many times in sdn , but never got the satisfactory answer.This time again i am trying my luck.
        Actually i am unable to understand how costing takes place in variant configuration.
        Suppose i have created one sales order for configurable material and there we select all the characteristics values which we want.
    But we don't maintain the prices of these characteristics values anywhere.So when i create the sales order than how the sales people calculate the cost of that order.
        Take a example of computer.For making computer,i want cabinet, processor, Harddisk, Ram, which are available in many sizes.So What we do that we create one configurable material and inside it we maintain all this characteristics and its values.And then i create one sales order for that configurable material and select the suitable characteristics and its values as reqd my customer.
         Now my question is how they cost that sales order?As we don't maintain the Accounting and costing view in material master of configurable material.
       So where to maintain the prices of these characteristics values?
            Plz guide.

    Hi
    You can make the price of a variant dependent on the characteristic values assigned (Pricing).You can use
    variant conditions to define surcharges and discounts for a variant
    Variant u2013Pricing steps
    Create condition record
    create a procedure where you enter the reference from the characteristic
    Assign the procedures to either the characteristic values
    configure the material in the sales order
    The net price for the material is displayed
    If a value that triggers a variant condition is selected when configuring a material in a sales order, the price of the material displayed under Net value is automatically increased or reduced.
    In addition, the Conditions pushbutton is displayed.
    On pressing this pushbutton,
    One can see which conditions have
    influenced the price.
    I tried to list you as much detail as possible. Hope that you will be able to resolve your issue
    Thanks

  • How to create and use cache

    hi all,
    In my web application I have to maintain cache. how can i create cache and how can I use that cache objects.
    thank you in advance....

    Your question is vague, so what follows is just a wild guess.
    Depending on your application's needs you can use one of the following contexts that are available for J2EE web applications:
    - ServletContext (for an application-wide cache)
    - HttpSession (well, for a session-specific cache)
    - HttpServletRequest (for a request-scoped cache)
    All of the contexts listed above provide getAttribute/setAttribute methods that can be used to store values in the respective contexts.

  • What's up with the new Safari? I've done all the "tips". Still slow!

    I've tried all these prophylactic measures and read an hour's worth of articles about the new Safari (Version 5.0, 5533.16 apparently). But it gets stuck on even the most basic of Internet pages.
    Safari used to load eBay, Associated Content, TED, YouTube, Craigslist, StumbleUpon, etc. in mere SECONDS. Now all I see is a loading bar that gets stuck about 1/16 (just past the www....) in the loading process.
    Yeah, I've cleared the cookies and cache and all the whatnots. I'm not a computer genius but I can tell something is going on. Is Apple keeping a secret record of everything I do or what? Seriously, this is frustrating!
    To summarize:
    I used to pop open Safari and get my homepage, www.google.com, in less than one second. Now I get a blank page that gets stuck, takes about thirty seconds, and then finally finds its way.
    What can I REALLY do to make my new Safari work like it used to?
    Or, how can I get the old version of Safari back?
    And I've tried Firefox and other browsers, but they're messy and not as clean as my ol' Safari used to be. What's happening here?
    I'm not impatient, I just can tell that something wrong is going on. And I'd like to fix it.

    Hi there!
    Thanks for heads up. My Macbook says I'm running 10.5.8 right now.
    The steps I've taken:
    I deleted the weird web icons document (I think it was a .dlb or .lb or something in the Library folder for Safrari in my hardrive) which didn't seem to do much, and I've went to my Safari preferences and deleted all ma' cookies, changes my cookie preferences to "only accept from sites I visit" and I've done the "delete cache" option from the Safari menu as well as the "reset Safari" option (which I regularly do anyway 'cause it seems to keep things moving quickly). I've also restarted my computer a couple of times, usually after completing one of these suggestions.
    I'm using my computer from home on a wireless router thing from Netgear with super-high-speed way-too-expensive broadband Internet from our local provider, Charter. It's called a Negear Wireless Rangemax Router. I've never had a problem with it before, and 3-4 people use the Internet here at my home, often simultaneously, without difficulty.
    I'm gonna' try pluggin' in the ethernet cable now. Thanks! I appreciate it!
    --- I will say, after climbing up on a wobbly chair and plugging my laptop into the cable directly, that it worked a bit faster, but it still got "stuck" (which is what I'm now officially calling this phenomenon). For example, Google loaded in about five seconds instead of ten, and Safari generally responded better to random clicking around on links, but this page got "stuck" at "http://disc..." for quite a while (well, longer than your average modern day computer, I'd say; it still felt like I was on my old Powerbook) and then diddled around a while, until I refreshed the page and it loaded almost instantly.
    I noticed, too, that the biggest problem it seems to have is loading new web pages that I don't visit frequently. For example, I'll search "Leo Tolstoy" on Google, click on the Wikipedia page, and it just stops! The blue loading bar gets to about "http://en.wiki..." and then it just plain stops. Just a few days ago, it would breeze along with super fast speed.
    Thanks again. I appreciate your feedback!
    Something fishy is going on, for sure.
    Message was edited by: danwlawrence

  • Incorrect totals from cache with CustomRollupColumn and non-parent-child dimensions

    Hello. Before I start let me apologise for my English :)
    We have a very complex cube, with 2 (actually more, but only these 2 are important) parent-child dimensions.
    One of them has CustomRollupColumn defined.
    Not long ago we have decided to make refactoring of our cube. This also included making these dimensions non-parent-child.
    All our old reports started to work much faster after that... but we have mentioned that sometimes they show incorrect totals, or no totals at all.
    We spend a lot of time trying to figure out what's wrong and finally we had found that if we clear cache before next refresh of the report - the totals are always correct!
    If we don't clear cache - we get wrong totals second time, and each next time after that. If we see wrong totals - we could clear cache and get correct totals once again.
    If we use "Real Time Olap=True;" connection string parameter - the totals are always correct because cache is not used.
    But we don't like this workaround.
    Is there any fix for this bug? Google shows that this problem exists from SQL2005, and still we have it :( Also, there is adivice to set CalculationCoverPolicy to 9 - we have tried - but it was fruitless.
    And if we revert these 2 dimensions back to parent-child - all working fine again, but as slow as it was before the refactoring :(

    Hi Bateks,
    Glad to hear that your issue had been solved by yourself, thank you for you sharing which will help other forum members who have the similar issue.
    Regards,
    Charlie Liao
    TechNet Community Support

  • CPALookupException: Could not find channel in CPA Cache in PI 7.3

    Hi,
    I am getting below error in PI 7.3 when  trying to send data from SOAP sender Adapter.
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.af.service.cpa.impl.exception.CPALookupException: Could not find channel in CPA Cache. Object ID: f3898d7d5ca3380a8aca739cc21b0cac. Cause: com.sap.aii.af.service.administration.api.monitoring.ChannelUnknownException: Channel was not found in CPA Cache: f3898d7d5ca3380a8aca739cc21b0cac due to: Got &lt;null> from CPA-cache.
    Steps
    1.) deleted Old communication channel and ICO and activated
    2.) Done full CPA Cache refresh
    3.)   Created communication Channel and ICO
    4.) Activated
    But when i checekd in communication channel i found above error.
    Regards,
    Anurag

    Hi all,
    has anybody found a good solution for this problem?
    We face the same problem over here, working with SOAP Sender Adapter (XI 3.0 Protocol) & Integrated Configuration on PI 7.3. The only thing that seems to help is to restart the Adapter Framework but that´s not an option on the production system.
    Best regards,
    Matthias

Maybe you are looking for