The cache's transaction boundary for db cacheStore

Hi !
I implement a CacheStore interface to cache db data,when I use cache.put() , the value can be persist into db,it's a statement level transaction, how can i control a code fragment's transaction boundary
such as:
cache.put(key1,value1);
cache.put(key2,value2);
when the last operation fail the first operation can be rollback by theory, the conclusion the other question is the cache.storeAll is handled by multi-thread , the some values has persited into db ,but one fail ,it's violates business's atomicity ,how can handle this situation?

Hi Stephen,
You can do the cache operations as a part of a single transaction by using a transactional cache. Something like ...
Connection conn =  new DefaultConnectionFactory().createConnection();
OptimisticNamedCache cache1 = conn.getNamedCache("tx-cache1");
OptimisticNamedCache cache2 = conn.getNamedCache("tx-cache2");
OptimisticNamedCache cache3 = conn.getNamedCache("tx-cache3");
conn.setAutoCommit(false);
cache1.insert(key1, value1);
cache2.insert(key2, value2);
cache3.remove(key3);
conn.commit();You are correct that you cannot currently use write-behind with a transactional cache. I'm not sure of your requirements but if you don't need the database updates to be part of the transaction then you could possibly do something by registering a MapListener with the transactional caches. Events occur on the transactional cache at commit time.
Another thing to keep in mind is that there are some other limitations with transactional caches and there is a performance cost. See the documentation for more details.
Thanks,
Tom

Similar Messages

  • How can I make WL 8.1 flush the cache and/or pool for 1.1 EJBs

    Hi,
    I'm using 1.1 deployment descriptors for my CMP entity bean that were previously
    used in the WL 5.1 version of my project.
    Things do get deployed but I've observed confusing information when monitoring
    the EJB via Admin Console.
    What appears is that the Weblogic container is not flushing the cache and/or pool
    after the bean has finished processing and also a sufficient time has expired
    (i.e. the idle-timeout-seconds)
    From what I've understood via the on-line information is that each EJB has its
    own cache (since I've not done anything special for that) and the instance in
    cache is only passivated when the cache is full and the server need to activate
    another instance. On passivation, it appears to be returning the instance to the
    pool. But its unclear/undocumented when the pool is cleared, if at all.
    What I want is that:
    1. A way to get my cached instance passivated
    2. A way to get my pooled instance flushed.
    The reason I'm looking into this is becasue in my case it appears that the cached/pooled
    instance are contributing to OutOfMemory errors and because of the nature of requirements,
    etc. we need to have the cache size be high for certain processing.
    Thanks
    Parasher

    I think it's probably best to contact technical support about this.
    There are different patches for different versions of WLS.
    I'd mention 'CR128026' to them to get started.
    -thorick
    "Parasher" <[email protected]> wrote:
    >
    Hi,
    Thank you for your reply !
    How can I get more information about this patch and the patch itself
    Is there a way I can look it up online or do I have to contact the support
    folks
    and if so what should I need to tell them to convey which patch I'm talking
    about.
    Thank you in advance.
    Parasher
    "thorick" <[email protected]> wrote:
    Hi,
    If you use 'Database' concurrency, then there is a patch available for
    some 8.1
    service
    packs to enable idle-timeout-seconds on the cache. I believe that this
    will be
    standard
    feature with the next service pack. There is no comparable mechanism
    for the
    pool in 8.1,
    this is a feature that is coming with the next major release of WLS.
    If the
    8.1 patch works
    for you, it can save you memory during off peak usage times. Notethat
    this
    patch does not
    work for 'Exclusive' concurrency.
    -thorick

  • Hiding the Pushbuttons in Transaction iView for the Selection Screen.

    Hi -
    There is a need to Hide the Pushbuttons in the transaction i-view which is being created for a custom transaction.
    The pushbuttons that needs to be disabled are like 'Save as Variant' , 'Choose Variant' etc..
    How do we go about doing it.
    Thanks,
    Maheshwari

    hi..
    You can use this
    case sy-tcode.
    WHEN 'I-VIEW'.
          LOOP AT SCREEN.
            IF screen-name CS 'SAVE _AS _VARIANT.
              screen-input = 0.
              MODIFY SCREEN.
            ENDIF.
          ENDLOOP.
    endif.
    ENDCASE.
    hope it will help you.
    regards,
    Lokesh
    Edited by: Lokesh Tripathi on Jul 21, 2008 1:13 PM
    Edited by: Lokesh Tripathi on Jul 21, 2008 1:13 PM

  • The exit of transaction ME21N   for version  ECC 6.0

    The version of my system is ECC 6.0 . 
    Some exit for ME21N  here is useless,
    Does anyone know any new exit for this version.
    The exit when the Purchase order is created or changed.
    Thanks
    Regards!
    Message was edited by: liwei zhuang
    Message was edited by: liwei zhuang

    Oh  I am so sorry.    I wrote a wrong t-code . 
    The transaction I want to write is ME21N.
    I have tested the exit MM06E005. 
    But in this version, it is useless . 
    so.......

  • Query for clearing the caches automatically in the portal?

    Hi There,
    We are using EP Portal 6,currently we are having Oracle Archive logs issue which slows down the system.Now we are clearing the caches in the System Landscape-> Universal Worklist & Workflow->Universal Worklist Administration->Universal Worklist u2013Cache Admin by Manually.
    *Is there any steps to do it automatically which helps a lot?
    Thanks,
    Krishna.

    Hi,
    when you refresh the UWL it will clears the cache explicitly, Default time for UWl refresh is 5 min, You can automatically refresh the cache by changing the properties of UWL ivew (in Portal content) -
    sap_uwl_viewname  : DefaultView
    useNavigationId   : com.sap.pct.erp.mss.Main
    Check this wiki page for more info on cache interval change and more:
    http://wiki.sdn.sap.com/wiki/display/BPX/CompletedtasksdisappearonlyafterarefreshofUWL+cache
    all these work in EP 7 but not sure with EP 6.
    regards,
    Mahesh

  • Create RFx Response: An error occurred in the PD Layer transaction terminated

    Hello Experts,
    Currently we are in SRM 7.02 implemenation: we are facing below problem while creating RFx response with popup screen.
                             "An error occurred in the PD Layer transaction terminated"
    For this we have checked below
    1. http://scn.sap.com/thread/1912966    ----> it didn't help
    2. We have assigned SAP_ALL role to bidder also ----> Facing same issue
    3. Check Number ranges ---> everything is fine.
    there is no clue from above points.
    Thanks & Regards
    Sandeep.

    Hello Sandeep,
    I am facing the same problem while creating the RFx response in SUS side. Same error occurred while i am creating the Rfx response with bidder.
    error: An error occurred in the PD Layer transaction terminated
    Could you please let me know, did you find any solution for this issue?
    Thanks in advance!!
    Thanks,
    Anil

  • Changing default transaction timeout for 5.1

              Hi
              Does someone know a way to change the default ejb transaction timeout for
              WL5.1?
              The default is 300 secs, which is a bit too long for me.
              I know I can change it in each deployment descriptor but it would be easier
              and quicker if I could just change the default :-)
              Thanks
              Nicolas
              

    There is another way but I think it's more complicated.
    After reading the file you can use a java code (java embedded activity) and split the file.
    For each part of the split you can PUT by FTP the file with append mode. That way your transaction will run in few cycles with less time.

  • Transaction code for BADI : FMCH

    Hi,
         I want to know if there is any way to find the transaction code of a BADI.
         I've a BADI : FMCH , now how can I find the transaction code in which this BADI  is used.
    Thanks

    Hi,
    Rather than the mentioned List of related Transaction Code, there exit a lot of other Transaction Codes.
    The procesdure for this to find the List of Transaction Code for a specfic BADI is very simple.
    SE18 -> <Mention BADI Name> ->  Display It -> When BADI is displayed click on Display Object List (CTLRSHIFTF5)
    -> Open the List seen at left side -> U will find the Workbench Browser open and List of Global data avalible for this BADI ->  Now Click on Transactions -> U would see the List of Transaction Code from Where u can get into this BADI.
    I hope this would help you in futher.
    Thanks.

  • Transaction Variant for VA03 in SAP 4.6C – Few Questions

    Hi Friends,
    To block ‘Net Value’ from being visible for specific users, for VA03 transaction, we have created a variant YVA03. Further, we had created a new transaction ZVA03 and activated this with the variant YVA03.
    Now, we observed, for the variant to work, we have to set the ‘variant’ field under VOV8 (sales document->Transaction flow) with‘NO_VARIANT’option.
    Why is this selection required? Will this have any impact on the working of standard transactions VA01/VA02 etc. (though we didn’t observe any)
    Also, is there a way we can activate custom transaction ZVA03 for all sales document types in one step i.e. without going through the task of setting every sales order type with ‘NO_VARIANT’ selection?
    Lastly, we are working on SAP 4.6C. Are there any known version limitations on the working of transaction variants for VAXX transactions?
    Please share your valuable inputs.
    Regards,
    Jagan

    Hello,
    Try adding the correct parameters in the user parameter settings in SU3/System->User profile->Own data.
    STC     Transaction variants: Transaction
    STV     Transaction variants: Variant
    Cheers,
    Balaji

  • Enhancing package 'load transactional data for BW infoprovider UI'

    Dear,
    for project reasons, we would like to enhance the package ''load transactional data for BW infoprovider UI'. To be more precisely, we want to add some dimensions to the method of data transfer 'replace & clear datavalues'. Now the system clears the data that mirror each entity/category/time/datasource. With only those dimensions, we cannot be precise enought, so in our case the system clears too many data. We want to be able to extend this with some dimensions.
    Is there any way this can be adapted ?
    thx.

    Hi Wouter,
    for a more precise delete you should execute first a clear and after import using Merge option.
    Kind regards
         Roberto

  • Compacting the cache-config.xml for multiple cache-store

    Hi,
    I have a cache-config.xml that has various ReadWriteBackingMaps with different CacheLoader implementations. I was wondering of the best way to compact this xml using the scheme-ref tag, as all I really need is schemes, with different cache stores. e.g. I have an InstrumentCacheStore and a CurrencyCacheStore .. which invoke different CacheLoaders. they are both distributed caches.
    I thought the below would work, but it dosen't.. :( when loading a currency, the InstrumentCacheStore gets invoked.
    is there a way to compact this XML? Else, for 6 different cache loaders that I have, do I have to specify the whole distributed-scheme again and again?
    <cache-config>
    <caching-scheme-mapping>
    <cache-mapping>
    <cache-name>instrument-*</cache-name>
    <scheme-name>distributed-instrument-scheme</scheme-name>
    </cache-mapping>
    <cache-mapping>
    <cache-name>currency-*</cache-name>
    <scheme-name>distributed-currency-scheme</scheme-name>
    </cache-mapping>
    </caching-scheme-mapping>
    <caching-schemes>
    <distributed-scheme>
    <scheme-name>distributed-instrument-scheme</scheme-name>
    <scheme-ref>distributed-scheme</scheme-ref>
    </distributed-scheme>
    <distributed-scheme>
    <scheme-name>distributed-currency-scheme</scheme-name>
    <scheme-ref>distributed-scheme</scheme-ref>
    <!-- THIS DOES NOT OVERRIDE THE DEFAULT distributed-scheme? -->
    <cachestore-scheme>
    <class-scheme>
    <class-name>coherence.cachestore.CurrencyCacheStore</class-name>
    </class-scheme>
    </cachestore-scheme>
    </distributed-scheme>
    <distributed-scheme>
    <scheme-name>distributed-scheme</scheme-name>
    <service-name>DistributedCache</service-name>
    <backing-map-scheme>
    <read-write-backing-map-scheme>
    <internal-cache-scheme>
    <local-scheme>
    <scheme-ref>LocalSizeLimited</scheme-ref>
    </local-scheme>
    </internal-cache-scheme>
    <cachestore-scheme>
    <class-scheme>
    <class-name>coherence.cachestore.InstrumentCacheStore</class-name>
    </class-scheme>
    </cachestore-scheme>
    </read-write-backing-map-scheme>
    </backing-map-scheme>
    <serializer>
    <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
    </serializer>
    <partition-count>5557</partition-count>
    <backup-count>1</backup-count>
    <thread-count>10</thread-count>
    <autostart>true</autostart>
    </distributed-scheme>
    <local-scheme>
    <scheme-name>LocalSizeLimited</scheme-name>
    <high-units>500000000</high-units>
    <low-units>10000</low-units>
    <unit-calculator>BINARY</unit-calculator>
    </local-scheme>
    </caching-schemes>
    </cache-config>
    --------------------------------------------------------------------------------------------------------------

    There are two possible ways to sort this out
    1. The cache configuration for the distributed-currency-scheme shown in the original post is wrong and does not correctly override the cache store, it should look like this:.
    <distributed-scheme>
      <scheme-name>distributed-currency-scheme</scheme-name>
      <scheme-ref>distributed-scheme</scheme-ref>
      <backing-map-scheme>
        <read-write-backing-map-scheme>
          <internal-cache-scheme>
            <local-scheme>
              <scheme-ref>LocalSizeLimited</scheme-ref>
            </local-scheme>
          </internal-cache-scheme>
          <cachestore-scheme>
            <class-scheme>
              <class-name>coherence.examples.CurrencyCacheStore</class-name>
            </class-scheme>
          </cachestore-scheme>
        </read-write-backing-map-scheme>
      </backing-map-scheme>
    </distributed-scheme> 2. You can use a single scheme and parameterise it like this:
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
      <caching-scheme-mapping>
        <cache-mapping>
          <cache-name>instrument-*</cache-name>
          <scheme-name>distributed-scheme</scheme-name>
          <init-params>
            <init-param>
              <param-name>cache-store-class-name</param-name>
              <param-value>coherence.examples.InstrumentCacheStore</param-value>
            </init-param>
          </init-params>
        </cache-mapping>
        <cache-mapping>
          <cache-name>currency-*</cache-name>
          <scheme-name>distributed-scheme</scheme-name>
          <init-params>
            <init-param>
              <param-name>cache-store-class-name</param-name>
              <param-value>coherence.examples.CurrencyCacheStore</param-value>
            </init-param>
          </init-params>
        </cache-mapping>
      </caching-scheme-mapping>
      <caching-schemes>
        <distributed-scheme>
          <scheme-name>distributed-scheme</scheme-name>
          <service-name>DistributedCache</service-name>
          <backing-map-scheme>
            <read-write-backing-map-scheme>
              <internal-cache-scheme>
                <local-scheme>
                  <scheme-ref>LocalSizeLimited</scheme-ref>
                </local-scheme>
              </internal-cache-scheme>
              <cachestore-scheme>
                <class-scheme>
                  <class-name>{cache-store-class-name}</class-name>
                </class-scheme>
              </cachestore-scheme>
            </read-write-backing-map-scheme>
          </backing-map-scheme>
          <serializer>
            <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
          </serializer>
          <partition-count>5557</partition-count>
          <backup-count>1</backup-count>
          <thread-count>10</thread-count>
          <autostart>true</autostart>
        </distributed-scheme>
        <local-scheme>
          <scheme-name>LocalSizeLimited</scheme-name>
          <high-units>500000000</high-units>
          <low-units>10000</low-units>
          <unit-calculator>BINARY</unit-calculator>
        </local-scheme>
      </caching-schemes>
    </cache-config>Parameter names from the init-params part of each cache mapping can be used inside curly brackets in the cache scheme part.
    Hope that helps,
    JK

  • JPA -- How can I turn off the caching for an entity?

    Hi,
    I have a problem that I will illustrate with a simplified example. I have created an entity:
    @Entity(name="Customer")
    @Table(name="CUSTOMERS")
    public class Customer implements Serializable {
    }I have also set the collowing properties in persistence.xml:
    <property name="toplink.cache.type.default" value="NONE"/>
    <property name="toplink.cache.size.default" value="0"/>
    <property name="toplink.cache.type.Customer" value="NONE"/>
    <property name="toplink.cache.size.Customer" value="0"/>
    <property name="toplink.cache.shared.Customer" value="false"/>And then I run the following code:
    Customer cust = em.find(Customer.class, 1L);
    System.out.println(cust);
    cust = em.find(Customer.class, 1L);
    System.out.println(cust);The problem: the second call to em.find does NOT generate a query to the database. Here's a fragment from the console log:
    [TopLink Fine]: 2007.05.11 02:55:05.656--ServerSession(2030438)--Connection(5858953)--Thread(Thread[Main Thread,5,main])--SELECT ID, SEX, NAME, MANAGER FROM CUSTOMERS WHERE (ID = ?)
         bind => [1]
    Customer: id=1, name=Customer #1, sex=MALE
    Customer: id=1, name=Customer #1, sex=MALECan anyone help me? Why isn't the caching turned off? I tried various combinations of properties. Nothing worked. I was expecting to see two queries to the database. I can see only one.
    I tried with TopLink Essentials Version 2 Build 39 and Version 2 Build 41.
    Best regards,
    Bisser

    The cache is likely turned off, but you can't tell because you are using the same transactional EntityManager instance for the two queries. The EntityManager requires its own cache for object identity and transactional purposes, as once you read an object in through the EM, the spec requires that all subsequent reads return the same instance. Only the EntityManager refresh will cause a refresh, that or setting your queries to use the toplink.refresh and toplink.cache-usage query hints.
    I would strongly recommend you use a query cache for performance, but there are of course reasons why one might not be the best option.
    http://weblogs.java.net/blog/guruwons/archive/2006/09/understanding_t.html
    is a good blog on understanding the caching used In TopLin Essentials.
    Best Regards,
    Chris

  • Do the Cache, CacheStore, and CacheLoader all need to run in the same JVM?

    do the Cache, CacheStore, and CacheLoader all need to run in the same JVM?
    Any help is appreciated.
    Thanks.

    they can be in differnt DP with no problem.
    Now question:
    1-MOH multicast/Unicast? (Multicast MOH ONLY support G711, so that could explain changing the DP fixnig the problem)
    [You can create a DP/region for MOH if multicast to talk G711 to everybody and the problem will get fix]
    Please Kudos/rate if this help!

  • What if the cache is not enough to hold one transaction's information

    Hi, all,
    I have the following concern:
    If I make the cache to 100 mb, and in a single transaction, I inserted about several million records, I am wondering if this kind of process will cause problem? Before transaction.commit() gets called, I think all inserts will remains in the memory to be committed. So, if the cache has only 100mb, which is not enough to hold several million records, what will happen?
    michael.

    To add to what Charles said, if you have a single transaction that writes millions of records you will almost certainly run out of memory. The data is on disk and does not need to be in memory, but there is a lock for every record written that is stored in memory. The locks will fill up the cache and then the heap and you'll very likely get OutOfMemoryError. The rule with most database, and JE is no exception, is that transactions should be kept as small as possible. As Charles said, DeferredWrite is more appropriate for an initial load.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Transaction code for live cache

    Hi experts,
    Please help for the following query.
    Log on to the liveCache with the SQL Studio/dbmcli as the liveCache user, and execute the following command
    SELECT count(*) from "/SAPAPO/ORDKEY"
                    where simid = '<noted VRSIOID>'
    I dont know the transaction code for live cache please suggest me how i login and exectue the query.

    Hi,
    The transaction code for live-cache is 'DB59'. Please let us know if you require further inputs.
    Regards,
    Birendra

Maybe you are looking for

  • Capturing the event on clicking the af:train stop icon

    We are using an af:train as follows <fnd:applicationsPanel> <f:facet name="appsPanelTrain"> <af:panelGroupLayout layout="horizontal" halign="center" id="panelGroupLayout2"> <af:train value="#{controllerContext.currentViewPort.taskFlowContext.trainMod

  • Displaying a file in a JSP

    Hello, I am new to the world of JSP programming. I was wondering if anyone would be able to help me with some advice? I need to be able to display the contents of a simple text file on a web page written in JSP and Java. I am happy with writing a JAV

  • Direct Customer and Vendor Creation

    MDG Gurus, I am looking for a way/approach using which a customer or a vendor can be created directly without the need of a Business Partner setup in the system. This question pertains to SAP MDG 6.1 Hope the question is clear Thanks Shantanu

  • Error 4.7.1 message exceeds size limit, but it doesnt

    I am receiving this error every time I try to send a message. The size of the message you are trying to send exceeds a temporary size limit of the server. The message was not sent; try to reduce the message size or wait some time and try again. The s

  • 508 Compliance, Quiz Radio Button and JAWS Reader

    Hello All, I'm using Captivate 5.5. The 508 compliance issue I'm having is that the Captivate-generated quiz radio buttons are not being properly read by JAWS.  The 508 finding states, "When the user selects a radio button anywhere in the course, the