Hashtable with persistent object as key and collection as value

I am trying to use a Hastable with a persistent object as the key and a
collection as the value. A long time ago, Abe White said:
"Kodo currently does not support a map in which the keys are persistent
objects and the values are collections. I think your best bet would be
to create an intermediate class that has a 1-1 relation to the "key" and
a collection of persistent objects for the "value". Then keep a
collection of these intermediate objects. You could use jdoPostLoad and
jdoPreStore to hash/unhash the collection of intermediate objects to/from
a Map if you need to."
So I made an intermediate class, which gave me a Hashtable with a persistent
object as the key and another for the value. Then the one for the value
contains the collection. This works but I'm wondering about the
performance, would this method be slower?
Also it was said that version 3.0 would support this. I'm curious if this
is available in 2.5 or if it's still planned for 3.0.
Thanks
Michael

I'm observing massive performance problems but I didn't think it could be
caused by this intermediary object but maybe that is the problem. For
example if I start a transaction to delete everything (with 3,000 records
which in turn has 3,000 records which in turn has 2 lists each) theprogram
crashes before it can finish the transaction. I then put in some loops to
delete 100 records at a time and this runs but it took over an hour to
delete the 3,000 records.
Do you have any other ideas of how to improve the performance? Are there
any alternatives?I solved the performance problem. I was storing web page content (all the
HTML) in a String which by default is in the default-fetch-group. I had
been thinking this was using lazy-loading but it wasn't. So I put
default-fetch-group=false for this property and now the performance is
great. It makes sense because it was retrieving approximately 5k of text
for each record! When deleting 3,000 records this comes out to be 14 megs.
Moral of the story: Use the default-fetch-group wisely!!

Similar Messages

  • Locking with Persistent Objects???

    Hi,
    while updating database with Persistent Objects? does persistent layer takes care of locking the records??
    i am not sure locking mechanism is there!!
    Please suggest

    From help.sap.com:
    If several programs use the Persistence Service to instantiate objects of the same class before one of these programs has changed the state using COMMIT WORK, all the objects will have the same initial state. At present, we have not implemented a Persistence Service lock concept, which would ensure that there was only one transient mapping for each persistent object. So ultimately, ABAP programmers are not really working with persistent objects as such; rather, the Persistence Service makes it appear as if they are.
    Regards
    Marcin

  • Problem with Persistent Object as Reference Attribute of Persistent Object

    Hello All,
    I have a problem with a persistent class that contains a reference attribute to another persistent class.  I can write the reference object attribute to the DB but when I read the reference attribute back from the DB the object is null.  Allow me to explain...
    I have two tables; one is a data table with one key field of type OS_GUID, the second is a mapping table with several business key fields and two further fields; an instance GUID and a class identifier GUID.  The data table is used to contain all the data for an object.  The mapping table is used to hold a relationship between the GUID assigned in the data table and the business key.  The mapping table has been structured in this way by following the help here:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/df/e785a9e87111d4b2eb0050dadfb92b/frameset.htm
    and the field mapping in persistent class for the mapping table has been mapped following the help here:
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/06/f23c33638d11d4966d00a0c94260a5/frameset.htm
    The code I use to create entries in the data and mapping table is:
    <-snip->
      DATA:
        gv_blank_data_guid TYPE REF TO zcl_ps_data,
        gv_data_guid       TYPE        os_guid,
        go_data_ps         TYPE REF TO zcl_ps_data,
        go_data_agent      TYPE REF TO zca_ps_data,
        go_data_map_ps     TYPE REF TO zcl_ps_data_map,
        go_data_map_agent  TYPE REF TO zca_ps_data_map,
        go_exc             TYPE REF TO cx_root.
      go_data_agent = zca_ps_data=>agent.
      go_data_map_agent = zca_ps_data_map=>agent.
      TRY.
    Check if there's already data with the business key on the DB
          go_data_map_ps = go_data_map_agent->get_persistent(
                             i_data_ref     = iv_data_ref
                             i_action       = iv_action ).
    ... if there is then exit.
          EXIT.
        CATCH cx_root INTO go_exc.
      ENDTRY.
      TRY.
    Create the data...
          go_data_ps = go_data_agent->create_persistent(
                           i_root_guid = gv_blank_data_guid
                           i_req_date  = iv_req_date ).
          TRY.
    ... finally, write the new data to the data business key map table
              go_data_map_ps = go_data_map_agent->create_persistent(
                                 i_data_ref     = iv_data_ref
                                 i_action       = iv_action
                                 i_data_guid    = go_data_ps ).    "note1
            CATCH cx_root INTO go_exc.
          ENDTRY.
        CATCH cx_os_object_not_found.
      ENDTRY.
      COMMIT WORK.
    <-snip->
    The fact that it is possible to pass the object GO_DATA_PS in the call to GO_DATA_MAP_AGENT (the line that I've put the comment "note1" on) indicates to me that the reference to the data persistent object can be written to the DB by the mapping persistent object.  After executing the above code the mapping table object and class identifier fields are populated.  Also, if multiple entries are written to the tables then the class identifier field in the mapping table is always the same and the object ID is different as expected.
    However, the problem I have is if I read an object from the DB using the business key with the following code:
    <-snip->
      DATA:
        gv_req_date        type        datum,
        gv_data_guid       TYPE        os_guid,
        go_data_ps         TYPE REF TO zcl_ps_data,
        go_data_agent      TYPE REF TO zca_ps_data,
        go_data_map_ps     TYPE REF TO zcl_ps_data_map,
        go_data_map_agent  TYPE REF TO zca_ps_data_map,
        go_exc             TYPE REF TO cx_root.
      go_data_agent = zca_ps_data=>agent.
      go_data_map_agent = zca_ps_data_map=>agent.
      TRY.
    Read data mapping with the business key
          go_data_map_ps = go_data_map_agent->get_persistent(
                             i_data_ref     = iv_data_ref
                             i_action       = iv_action ).
    ... then read the data.
          TRY.
              CALL METHOD go_data_map_ps->get_data_guid
                RECEIVING
                  result = go_data_ps.
            CATCH cx_os_object_not_found.
          ENDTRY.
        CATCH cx_root INTO go_exc.
      ENDTRY.
    <-snip->
    At no point during this code are the attributes of the object of the persistent class for the data table populated with the contents of the fields of the data table referenced as the attribute of the mapping table.  To clarify, when viewing the object in the debugger all the attributes of the mapping object that are simple table fields are populated with the values of the fields of in the mapping table, however, the attributes of the object that represents the persistent class for the data table are not populated with the fields of the data table.  I had hoped that by reading the mapping table object the data object would automatically be populated.  Is there another step I need to perform to populate the data object?
    I'm sorry if the above is hard to follow.  Without being able to provide screenshots it's difficult to explain.
    If someone has managed to store references to persistent objects in a table and then read the references back could you list the steps you went through to create the persistent classes and include the code that reads the objects please?  The code I have almost works, I must be just missing some subtle point...
    Thanks in advance,
    Steve.

    Hi Andrea,
    The iObject being replicated at item level for Service Complaints is the SAP standard behaviour.
    Generally we raise complaint refering to some sales or service issues. In your scenario you are trying to create a complaint based on an iObject, then you have to mention the corresponding product details. I dont see any business requirement not to copy the iObject product at the item level.
    If you want it then I think only you have to write a Z program for it.
    Hope this helps!
    Regards,
    Chethan

  • Installation of 27" cinema display with macbook pro silver key and bootcamp

    For everyone out there who may be interested in using the new 27" cinema display with an older Macbook Pro Intel with silver keys and bootcamp.
    What is needed:
    1. Apple 27" cinema display.
    2. Macbook pro Intel silver key model
    3. Altona Dual Link DVI to Mini DisplayPort Converter (Model AT-DP400)
    4. Bootcamp 3.1 drivers from Mac OSX Snow Leopard V10.6.3(retail)
    Procedure:
    1. Update your display software on the Mac OS side. Apple has posted an update on their software downloads page, "LED Cinema Display Software Update 1.0" After doing so, make sure that the 27" CinDisp is operating correctly and you can change the brightness from the system settings.
    2. On the Windows side, install the bootcamp 3.1 drivers. These are on the Snow Leopard distribution CD. However, there is a bug in the .msi installer that causes the installation to go into an endless loop. This must be resolved during the installation of the drivers. The following article discribes how to do this:
    http://discussions.apple.com/thread.jspa?threadID=2305631&tstart=0
    3. After you have successfully installed the bootcamp 3.1 drivers, then install Apple's bootcamp update: "Apple Magic Trackpad and 27-inch LED Cinema Display Update for Windows 32 bit".
    Good luck, it works!

    I have the same MBP and recently bought a 23" cinema display on Craigslist for $140.  It works great.  I had a display port to DVI adapter and it worked fine.  Built a stand to hold the laptop vertically so it's out of the way.  Don't know about older displays but anything with DVI should work fine.
    The screen size and resolution are great for photo editing.  I now have the best of both worlds, a display that rivals my wife's iMac and portability.

  • TS2634 Having issues with touch screen selecting keys and buttons I don't touch

    I'm having issues when messaging or using the browser with the key pad it will jump up and down the screen,  select buttons I don't want or the wrong messages. It basically wigs out at times, usually when I'm charging it, or listening to a radio station and trying to message at the same time. Any suggestions on why this is happening or how to fix it?

    thana88,
    Sorry to hear that you have had multiple service events, and yet problems persist.
    Please send me a private message with your contact information - name, phone number and the type / serial number of your flex 14.  If you have any of the service case numbers, please include these as well..
    We can work to escalate this
    Mark
    ThinkPads: S30, T43, X60t, X1, W700ds, IdeaPad Y710, IdeaCentre: A300, IdeaPad K1
    Mark Hopkins
    Program Manager, Lenovo Social Media (Services)
    twitter @lenovoforums
    English Community   Deutsche Community   Comunidad en Español   Русскоязычное Сообщество

  • Problem with printout for Mvtype 551 and Collective slip

    Hi there!
    Need some help.
    Well, I have several items and when posting them with 551 in MIGO and check printing active on collective slip (3), the printout does not show any of items.
    When posting it with same MvType 551 and check printing active on other two values (1 or 2), I get 1 printout for every item.
    So, what should I do to have one printout for all items for MvType 551?
    Thanks!

    Hi Ines,
    Go to NACE, select ME (Inventory Mgmt), click on procedures, select Inventory Mgmt, click on control.
    Here you should find an entry for your condition type there should an entry with requirement type having a value, for GR it is 173, so for your case, check which one applies.
    If helpful award points
    Regards,
    Vivek

  • Keybd_event with third party Virtual Key and WM_KEYDOWN

    Hi All,
    I want to use keybd_event() to send this third party virtual key called VK_OEM_CLR or 0xF5 to other application.
    Third party header file defined:
    #define VK_OEM_CLR 0xF5
    The application that sends the key:
    keybd_event(VK_OEM_CLR , 0, KEYEVENTF_EXTENDEDKEY, 0);//try this, but other application does not receive WM_KEYDOWN
    keybd_event(0xF5 , 0, KEYEVENTF_EXTENDEDKEY, 0);//try this, but other application does not receive WM_KEYDOWN
    The other application that will receive the sending key:
    LRESULT CALLBACK LLKbdProc(int nCode, WPARAM wParam, LPARAM lParam);
    HHOOK kbdhk;
    int quit = 0;
    HINSTANCE m_hHookApiDLL = NULL;
    typedef LRESULT (CALLBACK* HOOKPROC)(int code, WPARAM wParam, LPARAM lParam);
    typedef HHOOK (__stdcall *SetWindowsHookExW)(int, HOOKPROC, HINSTANCE, DWORD);
    typedef LRESULT (__cdecl *CallNextHookEx)(HHOOK, int, WPARAM, LPARAM);
    typedef LRESULT (__cdecl *UnhookWindowsHookEx)(HHOOK);
    static SetWindowsHookExW m_pfSetWindowsHook;
    static CallNextHookEx m_pfCallNextHook;
    #define WH_KEYBOARD_LL 20
    typedef struct {
    DWORD vkCode;
    DWORD scanCode;
    DWORD flags;
    DWORD time;
    ULONG_PTR dwExtraInfo;
    } KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;
    void Dbg( TCHAR * lpszFormat, ... )
    TCHAR szOutput[1024];
    TCHAR * pOutput = szOutput;
    va_list v1;
    DWORD dwSize;
    // Now do the normal printf stuff...
    va_start( v1, lpszFormat );
    dwSize = ::wvsprintf( pOutput, lpszFormat, v1 );
    va_end( v1 );
    OutputDebugString(szOutput);
    _tprintf(szOutput);
    LRESULT CALLBACK LLKbdProc(int nCode, WPARAM wParam, LPARAM lParam)
    KBDLLHOOKSTRUCT *pKeyBoard = (KBDLLHOOKSTRUCT *)lParam;
    switch( pKeyBoard->vkCode )
    case 245://VK_OEM_CLR,0xf5,245
    switch(lParam)
    case WM_KEYDOWN:
    Dbg(_T("receives VK_OEM_CLR, hex 0xf5, decimal 245 on WM_KEYDOWN\r\n"));
    return 1;
    case WM_KEYUP:
    Dbg(_T("receives VK_OEM_CLR, hex 0xf5, decimal 245 on WM_KEYUP\r\n"));
    return 1;
    default:
    Dbg(_T("receives VK_OEM_CLR, hex 0xf5, decimal 245 \r\n"));
    break;
    return 1;
    break;
    default: // no processing on this key
    Dbg(_T("switch-case: Unknown key\r\n"));
    return m_pfCallNextHook( NULL, nCode, wParam, lParam );
    return 0;
    int main()
    m_hHookApiDLL = LoadLibrary(L"coredll.dll");
    if(m_hHookApiDLL != NULL)
    HINSTANCE appInstance = GetModuleHandle(NULL);
    m_pfSetWindowsHook = (SetWindowsHookExW)GetProcAddress(m_hHookApiDLL,L"SetWindowsHookExW");
    kbdhk = m_pfSetWindowsHook(WH_KEYBOARD_LL, LLKbdProc, NULL, 0);
    if (!kbdhk)
    Dbg(_T("WH_KEYBOARD_LL FAILED.\r\n"));
    return -2;
    //Dbg(_T("Message Pump... Listening...\r\n"));
    MSG msg;
    while(GetMessage(&msg, NULL, 0, 0) > 0)
    if (quit) break;
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    return 0;
    The application that receives the key, always catch the virtual key for VK_OEM_CLEAR, but there is no WM_KEYDOWN.  Am I doing something wrong?

    That is it.. Thank you so much.  other cases I use wParam,
    but overlook for this case.

  • Huge performance differences between a map listener for a key and filter

    Hi all,
    I wanted to test different kind of map listener available in Coherence 3.3.1 as I would like to use it as an event bus. The result was that I found huge performance differences between them. In my use case, I have data which are time stamped so the full key of the data is the key which identifies its type and the time stamp. Unfortunately, when I had my map listener to the cache, I only know the type id but not the time stamp, thus I cannot add a listener for a key but for a filter which will test the value of the type id. When I launch my test, I got terrible performance results then I tried a listener for a key which gave me much better results but in my case I cannot use it.
    Here are my results with a Dual Core of 2.13 GHz
    1) Map Listener for a Filter
    a) No Index
    Create (data always added, the key is composed by the type id and the time stamp)
    Cache.put
    Test 1: Total 42094 millis, Avg 1052, Total Tries 40, Cache Size 80000
    Cache.putAll
    Test 2: Total 43860 millis, Avg 1096, Total Tries 40, Cache Size 80000
    Update (data added then updated, the key is only composed by the type id)
    Cache.put
    Test 3: Total 56390 millis, Avg 1409, Total Tries 40, Cache Size 2000
    Cache.putAll
    Test 4: Total 51734 millis, Avg 1293, Total Tries 40, Cache Size 2000
    b) With Index
    Cache.put
    Test 5: Total 39594 millis, Avg 989, Total Tries 40, Cache Size 80000
    Cache.putAll
    Test 6: Total 43313 millis, Avg 1082, Total Tries 40, Cache Size 80000
    Update
    Cache.put
    Test 7: Total 55390 millis, Avg 1384, Total Tries 40, Cache Size 2000
    Cache.putAll
    Test 8: Total 51328 millis, Avg 1283, Total Tries 40, Cache Size 2000
    2) Map Listener for a Key
    Update
    Cache.put
    Test 9: Total 3937 millis, Avg 98, Total Tries 40, Cache Size 2000
    Cache.putAll
    Test 10: Total 1078 millis, Avg 26, Total Tries 40, Cache Size 2000
    Please help me to find what is wrong with my code because for now it is unusable.
    Best Regards,
    Nicolas
    Here is my code
    import java.io.DataInput;
    import java.io.DataOutput;
    import java.io.IOException;
    import java.util.HashMap;
    import java.util.Map;
    import com.tangosol.io.ExternalizableLite;
    import com.tangosol.net.CacheFactory;
    import com.tangosol.net.NamedCache;
    import com.tangosol.util.Filter;
    import com.tangosol.util.MapEvent;
    import com.tangosol.util.MapListener;
    import com.tangosol.util.extractor.ReflectionExtractor;
    import com.tangosol.util.filter.EqualsFilter;
    import com.tangosol.util.filter.MapEventFilter;
    public class TestFilter {
          * To run a specific test, just launch the program with one parameter which
          * is the test index
         public static void main(String[] args) {
              if (args.length != 1) {
                   System.out.println("Usage : java TestFilter 1-10|all");
                   System.exit(1);
              final String arg = args[0];
              if (arg.endsWith("all")) {
                   for (int i = 1; i <= 10; i++) {
                        test(i);
              } else {
                   final int testIndex = Integer.parseInt(args[0]);
                   if (testIndex < 1 || testIndex > 10) {
                        System.out.println("Usage : java TestFilter 1-10|all");
                        System.exit(1);               
                   test(testIndex);               
         @SuppressWarnings("unchecked")
         private static void test(int testIndex) {
              final NamedCache cache = CacheFactory.getCache("test-cache");
              final int totalObjects = 2000;
              final int totalTries = 40;
              if (testIndex >= 5 && testIndex <= 8) {
                   // Add index
                   cache.addIndex(new ReflectionExtractor("getKey"), false, null);               
              // Add listeners
              for (int i = 0; i < totalObjects; i++) {
                   final MapListener listener = new SimpleMapListener();
                   if (testIndex < 9) {
                        // Listen to data with a given filter
                        final Filter filter = new EqualsFilter("getKey", i);
                        cache.addMapListener(listener, new MapEventFilter(filter), false);                    
                   } else {
                        // Listen to data with a given key
                        cache.addMapListener(listener, new TestObjectSimple(i), false);                    
              // Load data
              long time = System.currentTimeMillis();
              for (int iTry = 0; iTry < totalTries; iTry++) {
                   final long currentTime = System.currentTimeMillis();
                   final Map<Object, Object> buffer = new HashMap<Object, Object>(totalObjects);
                   for (int i = 0; i < totalObjects; i++) {               
                        final Object obj;
                        if (testIndex == 1 || testIndex == 2 || testIndex == 5 || testIndex == 6) {
                             // Create data with key with time stamp
                             obj = new TestObjectComplete(i, currentTime);
                        } else {
                             // Create data with key without time stamp
                             obj = new TestObjectSimple(i);
                        if ((testIndex & 1) == 1) {
                             // Load data directly into the cache
                             cache.put(obj, obj);                         
                        } else {
                             // Load data into a buffer first
                             buffer.put(obj, obj);                         
                   if (!buffer.isEmpty()) {
                        cache.putAll(buffer);                    
              time = System.currentTimeMillis() - time;
              System.out.println("Test " + testIndex + ": Total " + time + " millis, Avg " + (time / totalTries) + ", Total Tries " + totalTries + ", Cache Size " + cache.size());
              cache.destroy();
         public static class SimpleMapListener implements MapListener {
              public void entryDeleted(MapEvent evt) {}
              public void entryInserted(MapEvent evt) {}
              public void entryUpdated(MapEvent evt) {}
         public static class TestObjectComplete implements ExternalizableLite {
              private static final long serialVersionUID = -400722070328560360L;
              private int key;
              private long time;
              public TestObjectComplete() {}          
              public TestObjectComplete(int key, long time) {
                   this.key = key;
                   this.time = time;
              public int getKey() {
                   return key;
              public void readExternal(DataInput in) throws IOException {
                   this.key = in.readInt();
                   this.time = in.readLong();
              public void writeExternal(DataOutput out) throws IOException {
                   out.writeInt(key);
                   out.writeLong(time);
         public static class TestObjectSimple implements ExternalizableLite {
              private static final long serialVersionUID = 6154040491849669837L;
              private int key;
              public TestObjectSimple() {}          
              public TestObjectSimple(int key) {
                   this.key = key;
              public int getKey() {
                   return key;
              public void readExternal(DataInput in) throws IOException {
                   this.key = in.readInt();
              public void writeExternal(DataOutput out) throws IOException {
                   out.writeInt(key);
              public int hashCode() {
                   return key;
              public boolean equals(Object o) {
                   return o instanceof TestObjectSimple && key == ((TestObjectSimple) o).key;
    }Here is my coherence config file
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
         <caching-scheme-mapping>
              <cache-mapping>
                   <cache-name>test-cache</cache-name>
                   <scheme-name>default-distributed</scheme-name>
              </cache-mapping>
         </caching-scheme-mapping>
         <caching-schemes>          
              <distributed-scheme>
                   <scheme-name>default-distributed</scheme-name>
                   <backing-map-scheme>
                        <class-scheme>
                             <scheme-ref>default-backing-map</scheme-ref>
                        </class-scheme>
                   </backing-map-scheme>
              </distributed-scheme>
              <class-scheme>
                   <scheme-name>default-backing-map</scheme-name>
                   <class-name>com.tangosol.util.SafeHashMap</class-name>
              </class-scheme>
         </caching-schemes>
    </cache-config>Message was edited by:
    user620763

    Hi Robert,
    Indeed, only the Filter.evaluate(Object obj)
    method is invoked, but the object passed to it is a
    MapEvent.<< In fact, I do not need to implement EntryFilter to
    get a MapEvent, I could get the same result (in my
    last message) by writting
    cache.addMapListener(listener, filter,
    true)instead of
    cache.addMapListener(listener, new
    MapEventFilter(filter) filter, true)
    I believe, when the MapEventFilter delegates to your filter it always passes a value object to your filter (old or new), meaning a value will be deserialized.
    If you instead used your own filter, you could avoid deserializing the value which usually is much larger, and go to only the key object. This would of course only be noticeable if you indeed used a much heavier cached value class.
    The hashCode() and equals() does not matter on
    the filter class<< I'm not so sure since I noticed that these methods
    were implemented in the EqualsFilter class, that they
    are called at runtime and that the performance
    results are better when you add them
    That interests me... In what circumstances did you see them invoked? On the storage node before sending an event, or upon registering a filtered listener?
    If the second, then I guess the listeners are stored in a hash-based map of collections keyed by a filter, and indeed that might be relevant as in that case it will cause less passes on the filter for multiple listeners with an equalling filter.
    DataOutput.writeInt(int) writes 4 bytes.
    ExternalizableHelper.writeInt(DataOutput, int) writes
    1-5 bytes (or 1-6?), with numbers with small absolute
    values consuming less bytes.Similar differences exist
    for the long type as well, but your stamp attribute
    probably will be a large number...<< I tried it but in my use case, I got the same
    results. I guess that it must be interesting, if I
    serialiaze/deserialiaze many more objects.
    Also, if Coherence serializes an
    ExternalizableLite object, it writes out its
    class-name (except if it is a Coherence XmlBean). If
    you define your key as an XmlBean, and add your class
    into the classname cache configuration in
    ExternalizableHelper.xml, then instead of the
    classname, only an int will be written. This way you
    can spare a large percentage of bandwidth consumed by
    transferring your key instance as it has only a small
    number of attributes. For the value object, it might
    or might not be so relevant, considering that it will
    probably contain many more attributes. However, in
    case of a lite event, the value is not transferred at
    all.<< I tried it too and in my use case, I noticed that
    we get objects nearly twice lighter than an
    ExternalizableLite object but it's slower to get
    them. But it is very intersting to keep in mind, if
    we would like to reduce the network traffic.
    Yes, these are minor differences at the moment.
    As for the performance of XMLBean, it is a hack, but you might try overriding the readExternal/writeExternal method with your own usual ExternalizableLite implementation stuff. That way you get the advantages of the xmlbean classname cache, and avoid its reflection-based operation, at the cost of having to extend XMLBean.
    Also, sooner or later the TCMP protocol and the distributed cache storages will also support using PortableObject as a transmission format, which enables using your own classname resolution and allow you to omit the classname from your objects. Unfortunately, I don't know when it will be implemented.
    >
    But finally, I guess that I found the best solution
    for my specific use case which is to use a map
    listener for a key which has no time stamp, but since
    the time stamp is never null, I had just to check
    properly the time stamp in the equals method.
    I would still recommend to use a separate key class, use a custom filter which accesses only the key and not the value, and if possible register a lite listener instead of a heavy one. Try it with a much heavier cached value class where the differences are more pronounced.
    Best regards,
    Robert

  • Hashtable with more than two columns??

    Hi. i'm trying to make a cache in java.
    the cache neeeds to have three values per index location, Flag,Tag and Data. Is there anything in java that can have three values??
    I know hashtables can have two (one key, and one value), but i need one more, and also i need something that i can access with an index like you do with arrays.
    thanks

    rudeboymcc wrote:
    Hi. i'm trying to make a cache in java.
    the cache neeeds to have three values per index location, Flag,Tag and Data. Is there anything in java that can have three values??
    I know hashtables can have two (one key, and one value), but i need one more, and also i need something that i can access with an index like you do with arrays. An array or List storing objects of your own design that have three instance fields; flag, tag, data.

  • Object as Key in Dictionary

    Hi,
    In what scenarios classes or object types should be used as a key in dictionary? Is this really a good programming practice?
    I think not (as I can't think of any scenario where it's must) , please explain. 
    Regards, Vinay

     "if I have to add different type of object to one collection as key, and commands as values"
    So at any point of time, one object will have one command asociated with it... I still would not like to keep it inside dictionary. I can have command be as a property of object
    itself (Since the command is directly associated with the object... so there is no harm in keeping it as a part of the object itsef)...
    Sorry, but in my view; this does not add any value to my programm.
    Agree with one point which it says "depends on the idea and programming style"... In the real world "OOPs" I was trying to understand how using object in the dictionary gives me
    any kind of distinct advantage to my programm... So for example... adding supercharged engines to a car make it more powerful than a normal engine and ofcource to add power power to the same volume of the engine u need to have supercharging (may be turbocharging
    but yep... u need this)... else some one will have to increase the engine size!!!!
    With all the examples given above; I always have an alternative which in my view is better... or m more convinced to implement it other way around rather than storing
    the object as key.
    When some one speaks about performance benefit of keeping object ("Which by nature are more complex than value types") as key rather than containing the value in the object
    (though the dictionary will differentiate only on the basis of hashmap of the object)... I am not fully convinced that this will add to any performance gain over keep the object as value rather than key or rather keep the object in a non-keyvalue pair collection
    if someonly has to simply loop and achieve something.
    The reason why I started this debate was; since the object as a whole is quite complex; and property or unique reference is quite simple to identify the object. Why would some
    one like the object to classify properties/events/or an lesser entity at all??? A cleaner approach should be to classify objects by smaller entities like color/metal/engine to identify a car class for example etc... not a car to identify an engine!
    ofcource a programmer can go the other way... if wishes to!
    one possible scenario would have been in this case would have been, say an IT employee class collection to represent an IT department in an organisation. though this would
    have been ideal but then, it would have been really added un-necessary complexity to go on with dictionary or an custom key value collection approach in this case.
    I am still thinking about an appropriate example to fit in the scenario where I could have added object as a key in keyvalue collection to add some value to my code... in terms
    of performance... simplicity... flexibility!
    This was just my view... your feedback is welcome.

  • Encrypting a vote with a servers public key...HELP!

    Hey, I really need some help( online voting application)....what I want to do it allow a voter to be able to submit a ballot(vote) via servlets, they encrypt the ballot with the servers public key and then the ballot is stored in a database, where at another time the administrator may decrypt the ballot(s) using the servers private key. I have already sorted the voters authentication(MD5), and at the moment the servlet submits the ballot in an unencrypted form....so I just need a little help from here. I enclose my code and I would be truly grateful of someone could give me a hand.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.* ;
    public class CastVote extends HttpServlet{
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException,IOException{
    try {
    String jmulligan= request.getParameter("jmulligan");
    String pkelly=request.getParameter("pkelly");
    String mjones=request.getParameter("mjones");
    response.setContentType("text/html");
    PrintWriter out=response.getWriter();
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection ("jdbc:odbc:evoting");
    Statement stmt = con.createStatement();
    stmt.executeUpdate(
    "INSERT INTO Ballot (JMulligan, PKelly, MJones)"
    + "VALUES ('"+jmulligan+"','"+pkelly+"','"+mjones+"') ");
    stmt.close();
    out.println("<HTML>\n"+
    "<HEAD><TITLE>EVoting</TITLE></HEAD>\n"+
    "<BODY BGCOLOR=\"127734\">\n"+
    "<H1>Your Ballot has been entered as follows</H1>\n"+
    "<H1>J Mulligan got "+ jmulligan +"</H1>\n"+
    "<H1> M Jones got "+ mjones +"</H1>\n"+
    "<H1> P Kelly got "+ pkelly +"</H1>\n"+
    "</BODY></HTML>");
    catch( Exception e ) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    thanks
    Jacinta
    PS I have ssl configured, with a self signed cert.

    Hey!
    I am also in the middle of doing an en=voting application as part of my thesis! Its interesting to see the way other people do the voting. Well, my experience so far is that I cannot get public/private key encryption to work. I have posted many topics on this forum regarding it and the reason it wont work is that the ballot that I am trying to enctypt is too large for the ballot object . I used the RSA algoithm and it wasn't able to handle my large object. So instead I have just used a symmetric algorithm and that works fine. I think its the DES algorithm. The only problem with this is that you are using the same key to encrypt and decrypt the ballot. I dont think this is secure. It has been reccomended to me that I use this symmetric algorithm as it is, but that I then use public/private key to encrypt the symmetric key! I still have a problem with this because if the key is still encrypted with public key, the user must have acces to the private key to decrypt the symmetric key to decryt the ballot. See where I'm going?
    I would love to know of an asymmetric algorithm that can encrypt large objects. That would solve the whole security issue. I will post a replyhere if I find out the answer.
    By the way, how is your project going?
    All the best,
    Chris Moltisanti

  • How to save web service request key and response value in cache to reduce calling the service for same type of requests

    Hi
    I have a web service which return the response based on the request key.
    I need to save the key and the response value in cache for around 30mins
     to reduce the web service calls for better performance.
    Appreciate if any once can share a sample code

    using System.Runtime.Caching;
    public List<string> cachingwebserviceresponse()
    {//Create a cache key
    string strParameters = "1234";//Create a cache value holding object
    List<string> results = new List<string>();//Create a cache
    ObjectCache cache = MemoryCache.Default;//Assign key for the cache
    string cacheKey = strParameters;//Check whether the key exists in the cache//If exists assign the values from the cache instead of calling the webservice//else call the web service and add the response to the cache
    if (cache.Contains(cacheKey))
    results = cache.Get(cacheKey);
    else
    { //calling the web service client
    using (service.webservice fd = new service.webserviceContractClient())
    { //Call the web service function to get the results
    results = fd.DataSearch(strParameters);
    } //Create the cache expiration policy. I have created for 30 minutes.
    CacheItemPolicy cacheItemPolicy = new CacheItemPolicy();
    cacheItemPolicy.AbsoluteExpiration = DateTime.Now.AddMinutes(30); //Add the response to the cache based on the key
    cache.Add(cacheKey, results, cacheItemPolicy);
    return results;

  • Oracle 8i array DML operations with LOB objects

    Hi all,
    I have a question about Oracle 8i array DML operations with LOB objects, both CLOB and BLOB. With the following statement in mind:
    INSERT INTO TABLEX (COL1, COL2) VALUES (:1, :2)
    where COL1 is a NUMBER and COL2 is a BLOB, I want to use OCIs array DML functionality to insert multiple records with a single statement execution. I have allocated an array of LOB locators, initialized them with OCIDescriptorAlloc(), and bound them to COL2 where mode is set to OCI_DATA_AT_EXEC and dty (IN) is set to SQLT_BLOB. It is after this where I am getting confused.
    To send the LOB data, I have tried using the user-defined callback method, registering the callback function via OCIBindDynamic(). I initialize icbfps arguments as I would if I were dealing with RAW/LONG RAW data. When execution passes from the callback function, I encounter a memory exception within an Oracle dll. Where dvoid **indpp equals 0 and the object is of type RAW/LONG RAW, the function works fine. Is this not a valid methodology for CLOB/BLOB objects?
    Next, I tried performing piecewise INSERTs using OCIStmtGetPieceInfo() and OCIStmtSetPieceInfo(). When using this method, I use OCILobWrite() along with a user-defined callback designed for LOBs to send LOB data to the database. Here everything works fine until I exit the user-defined LOB write callback function where an OCI_INVALID_HANDLE error is encountered. I understand that both OCILobWrite() and OCIStmtExecute() return OCI_NEED_DATA. And it does seem to me that the two statements work separately rather than in conjunction with each other. So I rather doubt this is the proper methodology.
    As you can see, the correct method has evaded me. I have looked through the OCI LOB samples, but have not found any code that helps answer my question. Oracles OCI documentation has not been of much help either. So if anyone could offer some insight I would greatly appreciate it.
    Chris Simms
    [email protected]
    null

    Before 9i, you will have to first insert empty locators using EMPTY_CLOB() inlined in the SQL and using RETURNING clause to return the locator. Then use OCILobWrite to write to the locators in a streamed fashion.
    From 9i, you can actually bind a long buffer to each lob position without first inserting an empty locator, retrieving it and then writing to it.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by CSimms:
    Hi all,
    I have a question about Oracle 8i array DML operations with LOB objects, both CLOB and BLOB. With the following statement in mind:
    INSERT INTO TABLEX (COL1, COL2) VALUES (:1, :2)
    where COL1 is a NUMBER and COL2 is a BLOB, I want to use OCIs array DML functionality to insert multiple records with a single statement execution. I have allocated an array of LOB locators, initialized them with OCIDescriptorAlloc(), and bound them to COL2 where mode is set to OCI_DATA_AT_EXEC and dty (IN) is set to SQLT_BLOB. It is after this where I am getting confused.
    To send the LOB data, I have tried using the user-defined callback method, registering the callback function via OCIBindDynamic(). I initialize icbfps arguments as I would if I were dealing with RAW/LONG RAW data. When execution passes from the callback function, I encounter a memory exception within an Oracle dll. Where dvoid **indpp equals 0 and the object is of type RAW/LONG RAW, the function works fine. Is this not a valid methodology for CLOB/BLOB objects?
    Next, I tried performing piecewise INSERTs using OCIStmtGetPieceInfo() and OCIStmtSetPieceInfo(). When using this method, I use OCILobWrite() along with a user-defined callback designed for LOBs to send LOB data to the database. Here everything works fine until I exit the user-defined LOB write callback function where an OCI_INVALID_HANDLE error is encountered. I understand that both OCILobWrite() and OCIStmtExecute() return OCI_NEED_DATA. And it does seem to me that the two statements work separately rather than in conjunction with each other. So I rather doubt this is the proper methodology.
    As you can see, the correct method has evaded me. I have looked through the OCI LOB samples, but have not found any code that helps answer my question. Oracles OCI documentation has not been of much help either. So if anyone could offer some insight I would greatly appreciate it.
    Chris Simms
    [email protected]
    <HR></BLOCKQUOTE>
    null

  • [Qualif.] Difference between object type 'Q' and infotype 0024

    Hi,
    For the xRPM 4.0 solution, we need to maintain skills for resources. There is a HCM integration functionality to import skills from a HR system to Business Partners (which - basically - represent users that can be staffed on a project in the xRPM solution).
    Today, there is no skill management in our HR system.
    There are 2 notions that look very similar to me :
    - <b>Infotype 0024</b> [Transaction PA20/PA30] : contains Qualifications of a user in PA (Personal Adminsitration) with the standard table T574A holding the possible values
    - <b>Organizational Structure</b> (HRP1000/HRP1001) [transaction BP / PP* ?]: with the objects Qualifications 'Q' and Qualifications Group 'QK'
    It seems taht the integration operates on the Organizational Structure. But we would like to assess both solutions.
    <b>What is the difference (pros&cons) between the 2 of them ?</b>
    Thanks in advance.
    Best regards,
    Guillaume
    Message was edited by:
            Guillaume GARCIA

    To be precise, the way Infotype 24 behaves depends on whether integration between PA and PD is active.  This is controlled by setting PLOGI QUALI in table T77S0.  There are also other settings in this table that affect how quals work in an integrated scenario, you will find these in the QUALI XXXX section.
    If integration is active, the qualifications are maintained in a catalogue via transaction OOQA.  What you see in IT0024 are the object Q <--> P relationships as mentioned above once a qualification object has been assigned to the employee.  This option has the advantages of being able to use the integrated objects in othe modules e.g. as prerequisites or imparted quals in the training module, skills/requirements matchup etc.  The down side is that being PD objects, these are more difficult to report with SAP Query or Adhoc Query tools, but there are ways of doing it.
    If integration is not active, the data is simple stored in PA table PA0024 and the quals themselves are set up via the IMG.  The data really can't be used in any other module, but the reporting aspects are much easier with the standard query tools.
    Regards,
    John

  • List with multiple objects

    Hi,
    Is it possible can we have a List with multiple Object (CustomerVO, OrderVO and AddressVO) in a single List? If so how we will define the generics for that List?
    Please clarify.
    Thanks.

    797836 wrote:
    Guys, am I correct? Please clarify.If it works, it is correct. So try it.
    I was more thinking along the line of this though according to what you described in your initial post:
    Class ParentVO{
    private CustomerVO customer;
    private OrderVO order;
    private AddressVO address;
    // with getters and setters
    }That way you don't need any list at all, if you only want to have access to these three objects. Just slap them in a ParentVO and use that.
    Looking at it again I wonder if the ParentVO is needed even, there is a strong relationship between these three objects. An order has a customer and a customer has an address / an order has a billing/shipping address...

Maybe you are looking for

  • 16:9,  Black border all the way around the video.

    Using a Canon GL2 video camera I shot a short video in anamorphic 16:9. I then imported it into FCP, in the same format. Exported it and brought it into DVDSP in 16:9. Everything looked great on my 4:3 TV. It looked like it letterboxed just fine and

  • Lightroom 5 and Lens Correction-issue

    Hi, sometimes in LR4 I used the lens correction. Most pictures nowadays I take with an old NIkon 24-85:2.8-4 lens. When I tick lens correction and choose as manufacturer Nikon it automatically gave me the Nikon 24-85:3.5-4.5 (as the 2.8-4-version is

  • Print Flash Art in VECTORIAL MODE without BLANKS arround objects

         Dear Sirs, I need to solve this problem since 6 months ago, I nee d help from an expert to get a success, I have an flash aplication it receives by xml information for 4 movie clips to load movies into screen when it is ok, the screen is printin

  • Max. number of expressions exceeded

    I have a simple SQL to select data from a single table with a list of 1000 elements i.e. SELECT A FROM TABLE_A WHERE B IN (1, 2, 3, ..., 1000). It worked fine. If I added one more i.e. WHERE B IN (1, 2, 3, ...., 1000, 1001), then I got error 1795 - M

  • IPhone 8.0.2 acting up

    I'm so disappointed in the iPhone software update.  Honestly, I've been disappointed since I traded in my iPhone 4. The swipe feature works intermittently and it's crashed three times already. What's happened to the quality that I know existed in App