Optimistic Lock with Parent and Child relationships

Hi,
I just have a question regarding optimistic locking. We have a scenario
where a parent object has many child objects. Both the parent and the
child objects have a jdolockx column in the database/jdo file.
It appears that whenever you add a new child to the parent the parent's
optimistic lock counter is also updated.
eg
parent.getChildren().add(child);
child.setParent(parent);
Why does this occur? There is no change made to the database table for
the parent, except for the jdolockx column. Is there something that I can
do to stop the lock count from incrementing when I child is added?
We have a scenario where we have many threads of execution wishing to add
children to a single parent. The parent itself isnt modified but this
operation fails due to the parent lock counter being incremented.
Any help would be appreciated
Thanks
Luke

There is state image indicator in Kodo 3 which has more locking options
beyond a simple number:
http://solarmetric.com/Software/Documentation/3.0.1/docs/ref_guide_mapping_versionind.html#state-image
In addition, you can plug your own version indicator.
Our default optimistic locking avoids the problem of users having no
idea what is -actually- in the collection/set at any given time.
Inconsistencies can occur at the datastore level (user 1 adds
object a to collection, user 2 removes a, user 1 adds object b... which
should actually be in the DB? {a,b} or or {a}? This is one of the
many ways in which not tracking changes to a collection/set can be
hazardous).
On locking exceptions, errors could be handled in some appropriate
function (i.e. refresh, re-apply changes if applicable/safe,
and commit).
Luke wrote:
Hi,
I just have a question regarding optimistic locking. We have a scenario
where a parent object has many child objects. Both the parent and the
child objects have a jdolockx column in the database/jdo file.
It appears that whenever you add a new child to the parent the parent's
optimistic lock counter is also updated.
eg
parent.getChildren().add(child);
child.setParent(parent);
Why does this occur? There is no change made to the database table for
the parent, except for the jdolockx column. Is there something that I can
do to stop the lock count from incrementing when I child is added?
We have a scenario where we have many threads of execution wishing to add
children to a single parent. The parent itself isnt modified but this
operation fails due to the parent lock counter being incremented.
Any help would be appreciated
Thanks
Luke
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com

Similar Messages

  • Session expiration issue with parent and child window

    Hi,
    We have two applications (App1 - Implemented using JSF, Spring and Hibernate and App2 -Implemented using Spring MVC, Spring JDBC).
    I have implemented 'Test Access Content' functionality in App1.
    First admin user (Role- Manager) needs to login to App1
    As part of 'Test Access Content' functionality, he enters URL with encrypted key and click 'Test Access' button.
    It opens new window (implemented using java script - window.open) and hits spring controller of App2.
    In spring controller of App2, I am decrypting the key to get user details. After that i am setting user details in session, constructing final URL to display actual content.
    Problem is parent window maintains session till child window renders response. Once child window renders response, parent window loosing session.
    So, if i click any button in parent window after child window renders response, it displays login page as there is no session for parent window.
    Please note that App1 and App2 are sharing same domain. only context paths are different for both apps (app1 and app2).
    Any suggestions on this issue are much appreciated. Please let us know if you have any questions.

    Hi,
    When you open a child window from parent window then you can access child data in the parent window through javascript.
    We have a main web page. There are quite many links on it from which >user can open new web pages but the data is saved when the submit >button on the main page is clicked. Also data that user entered on the >other sub pages is not displayed in the main window.
    1 is this a case of parent and child window.case 1 When you are submitting the main page you need to run javascript function and get data from child windows and save that to database or session. next time when you are displaying the main window you need to query session or database to display the child window data in the main window.
    Case 2> closing child window and you need data in the parent. This can be done in two ways.
    1> When you are closing the child window populate some variables of the main window using javasript.
    2> Save the values in the database or session and refresh the main window and extract data from database or session
    Where should the data be saved that user enetered on the sub pages as the data is not shown in the main page - should it be stored in the session?It is design decision. You can store data in either session or database when you are closing the child window. But ifyou are saving the data on the main page then you can populate main page with child windows data using javascript. Save the data t database when main window data is saved. Depends on business requirements.
    In short if you are saving child windows data in session or database then you need to refresh main screen to pull that data otherwise populate main screen using javascript.
    I hope i answered your questions :) best of luck

  • Help Displaying Parent and child relationship on one page

    Hello,
    I have 2 tables, lets say Parent and Child, that I want to display both tables on the same page. Basically I'm looking at trying to split the page in half, the top being the Parent table and the bottom being the Child table. When the user selects a parent, I want the Child table to display that parent's child/children. I don't know if this is possible though JDeveloper but I would appreciate all the help I can get
    Thanks,
    Matt

    This is a trivial master detail task for ADF.
    Basically, in the data control palette - stand on the child node that is inside the parent node - drag it over to your page and drop it as a master detail - this will get you what you want.
    More information is in the ADF Tutorial:
    http://www.oracle.com/technology/obe/ADFBC_tutorial_1013/10131/index.htm

  • Issue with Master and child relationship,viewlink

    Hi Frnds,
    In one of our custom pages we have Master child relationship between Invoice lines and their distributions.
    Things work absolutely fine when total no of distributions(say 10) are equal to max no of distributions that can be shown on 1st page(i.e equal to advancetable property value 'Records displayed'..say set as 10)
    What happens is when in advance table I click on next button to navigate to next set of records and then edit some field that have any event..ppr or lov my control by default gets transferred to very first set of records.
    !!!!!!!!!!!!!! Also this happens only when no of invoice lines are more than 1.
    I not sure whether the issue is with VL,VO,AO or the advance table property.
    One simple solution that I have tried is...getting back the focus to the row that is updated but it causes some other problem.
    Any pointers will be very helpful
    Thanks in advance.

    Hi any help???

  • Please, help me with parents and childs

    hi,
    I just can't figure it out which mc is the parent and which
    are its children. Please help.
    Here's the code:

    THX. I saw the same "family tree", but I started to doubt as
    soon as I tried to add blur filter to menu items. I've found it on
    the www.kirupa.com (they have some great stuff there). Here is the
    direct
    LINK
    to the script. Can you tell me, how can I add a blur filter to menu
    items. By default they are blured and OnRollover they get cleared.
    regards

  • Request help to display a list with parent and child list item.

    I created a static list with items A,B,C and a child item A1 under parent A. I chose the template "vertical Side bar list". I am using theme 10 (sand) for my application. I created page 0 and am displaying the list on page template region position2. I am able to see the side bar with options A,B,C. But am not able to see the child option A1 when I click on Option A. I tried using 'DHTML MENU WITH SUB LIST' but When I click on option A, the child entry A1 is showing over the B and C options. I know this might be a pretty basic functionality. I am new to APEX and am just learning. I appreciate any help you give me.

    Mr.Backstrom,
    I have changed the list template overide to dhtml Tree. And now the list is being displayed as vertical unordered list with bullets. Is it possible to take off the bullets? Thank you for your time.
    Suma.

  • ORACLE SQL Query with Parent and Child structure

    I have 2 tables which are Account tbl and Customer tbl, the structure is like below:
    Account tbl
    Customer_ID    Account_ID    Parent_Account_ID    
    3780952        3780952         3780952
    3780997        3780997         3780997
    3781004        3781004         3780997
    Customer tbl (Customer_Group have different value, but im only interest on Personal)
    Customer_ID      Customer_Group
    3781004          Personal
    3780997          Personal
    3780952          PersonalThe rule to determine PS/NonPS, Principle, Supp as per below:
    **PS/NonPs**
    Customer_ID equal to Parent_Account and Parent_Account is unique (not exist more than 1)  then NonPs.
    Customer_ID equal to Parent_Account and Parent_Account is non unique OR -   Customer_ID is not equal to Parent_Account then PS    
    **Principle**  IF NonPS then Principle is Null IF PS - If Customer_ID equal to Parent_Account then Principle is Y else N
    **Supp** IF NonPS then Supp is Null IF PS - If Customer_ID not equal to Parent_Account then supp is Y else N The final output should be like this
    Customer_ID    Account_ID    Parent_Account_ID   PS/NonPS   Principle   Supp
    3780952        3780952       3780952             NonPS       Null        Null
    3780997        3780997       3780997             PS          Y           N
    3781004        3781004       3780997             PS          N           Y I alredy tried many times but still cant get the output..anyone can help ?

    hi,
    i hope this is what you want , this query matches all of your mentioned requirements .
    WITH accounts AS
         (SELECT 3780952 AS customer_id, 3780952 AS account_id,
                 3780952 AS parent_account_id
            FROM DUAL
          UNION ALL
          SELECT 3780997 AS customer_id, 3780997 AS account_id,
                 3780997 AS parent_account_id
            FROM DUAL
          UNION ALL
          SELECT 3781004 AS customer_id, 3781004 AS account_id,
                 3780997 AS parent_account_id
            FROM DUAL),
         customer AS
         (SELECT 3781004 AS customer_id, 'Personal' AS customer_group
            FROM DUAL
          UNION ALL
          SELECT 3780997 AS customer_id, 'Personal' AS customer_group
            FROM DUAL
          UNION ALL
          SELECT 3780952 AS customer_id, 'Personal' AS customer_group
            FROM DUAL)
    SELECT customer_id, account_id, parent_account_id, "PS/NonPS",
           CASE
              WHEN "PS/NonPS" = 'NonPS'
                 THEN NULL
              WHEN customer_id = parent_account_id
                 THEN 'Y'
              WHEN customer_id <> parent_account_id
                 THEN 'N'
           END principle,
           CASE
              WHEN "PS/NonPS" = 'NonPS'
                 THEN NULL
              WHEN "PS/NonPS" = 'PS' AND customer_id <> parent_account_id
                 THEN 'Y'
              WHEN "PS/NonPS" = 'PS' AND customer_id = parent_account_id
                 THEN 'N'
           END SUM
      FROM (SELECT   t1.customer_id, t1.account_id, t1.parent_account_id,
                     CASE
                        WHEN t1.customer_id = t1.parent_account_id
                        AND (SELECT COUNT (*)
                               FROM accounts
                              WHERE parent_account_id = t1.parent_account_id) = 1
                           THEN 'NonPS'
                        ELSE 'PS'
                     END "PS/NonPS"
                FROM accounts t1, customer t2
               WHERE t1.customer_id = t2.customer_id
            ORDER BY t1.customer_id)
    output
    CUSTOMER_ID     ACCOUNT_ID     PARENT_ACCOUNT_ID     PS/NonPS     PRINCIPLE     SUM
    3780952     3780952     3780952     NonPS          
    3780997     3780997     3780997     PS     Y     N
    3781004     3781004     3780997     PS     N     YThanks,
    P Prakash
    Edited by: prakash on Jan 17, 2012 3:38 AM

  • How to list selected parent and child rows with values from ADF TreeTable

    I created one tree table having three levels using DepartmentsVO, EmployeesVO and
    JobHistoryVO where these tables contains parent and child relationship on database.
    Then i added one more column to the tree table which displays selectBooleanCheckBox. This
    check box is available for parent and child rows in that column.
    My first concern is i
    want to list out all the parentids and its child ids from three levels where the check
    box is selected.
    second concern is
    if i select the check box for a parent row, then the remaining check boxes for child rows also select automatically which are comes under the parent row.
    Thanks in advance.
    jk

    hi Frank,
    Thanks for the quick reply...
    As I mentioned before I am able to get the children using JUCtrlHierNodeBinding. but wanted to change the value of child row which have specific data.
    Is it possible through JUCtrlHierNodeBinding to update data of child and parent?? If so then can you please post the code snippet for the same???
    Viral

  • Need help with arranging Parent and Child item accordingly

    Hi Experts,
    I have a sales BOM in SBO, here we need to show both the Parent and child items. but we do not have to show the Sr.no and Qty for the child items.
    Kindly help me out how I can do it.
    Below pasted is the image of my sales order,
    Also i have attached the report with it.
    Requesting you to kindly help..
    thanks and regards,
    Nandish.

    The Sales BOM helps in identifying that. The product in Red is the Parent Item and the product in Grey are Child items.  The paretn item is the table OITT.Code and child items are in ITT1.code.
    Let me now if you require more information.
    Also how can I send you the layout here for your reference?
    thanks in advance,
    Nandish.

  • Check for same parent and child combination

    hi all i am using oracle 10g. can you please help me in this issue.
    how do i know if the same combination of parent and child present in the table
    key value and value are the values given by user.
    if the user try to create a same profile with same set of key_value and value then that should be avoided
    so how to achieve that.
    example profile already in the table
    -- PROFILE_ID,DETAIL_ID,PARENT_DETAIL_ID,KEY_VALUE, VALUE, LAST_IND
    100,               1,               NULL,                      1,              CDE,     N
    100,               2,              1,                            2,              XXX,     N
    100,               3,              1,                            2,              YYY,    N
    100,               4,              1,                            4,              NEW,    Ynew profile by user -- it should throw an error saying that same profile already present
    -- PROFILE_ID,DETAIL_ID,PARENT_DETAIL_ID,KEY_VALUE,VALUE,LAST_IND
    101,               5,               NULL,                      1,              CDE,    N
    101,               6,              5,                            2,              XXX,    N
    101,               7,              5,                            2,              YYY,    N
    101,               8,              5,                            4,              NEW,    YEdited by: DeepakDevarapalli on Dec 9, 2009 9:48 AM
    Edited by: DeepakDevarapalli on Dec 9, 2009 9:59 AM

    sir i have used your logic, each query works fine and displays the correct results below are the results.
    SELECT   SUBSTR (t.ptxt, 2, LENGTH (ptxt)) profile_values
        FROM (SELECT     SYS_CONNECT_BY_PATH (rtxt, ',') AS ptxt
                    FROM (SELECT key_value || '/' || VALUE AS rtxt,
                                 ROW_NUMBER () OVER (PARTITION BY profile_id ORDER BY key_value,
                                  VALUE) AS rnum
                            FROM sp_profile_detail
                           WHERE profile_id IN (100, 101))
                   WHERE CONNECT_BY_ISLEAF = 1
              START WITH rnum = 1
              CONNECT BY rnum = PRIOR rnum + 1) t
    GROUP BY ptxtresults from query 1
    profile_values
    1/CDE,2/XXX,2/YYY,4/111
    1/CDE,2/XXX,2/YYY,4/222
    SELECT   SUBSTR (s.ptxt, 2, LENGTH (ptxt)) profile_values
        FROM (SELECT     SYS_CONNECT_BY_PATH (rtxt, ',') AS ptxt
                    FROM (SELECT key_value || '/' || VALUE AS rtxt,
                                 ROW_NUMBER () OVER (ORDER BY key_value,
                                  VALUE) AS rnum
                            FROM sp_profile_detail1)
                   WHERE CONNECT_BY_ISLEAF = 1
              START WITH rnum = 1
              CONNECT BY rnum = PRIOR rnum + 1) s
    GROUP BY ptxtresults from query 2
    profile_values
    1/CDE,2/XXX,2/YYY,4/111
    but when i tried to combine both and do a minus it throws me an error .
    ORA-00600: internal error code, arguments: [expcmo_strdef1], [27], [27], [], [], [], [], []
    -- target
    SELECT   SUBSTR (t.ptxt, 2, LENGTH (ptxt)) profile_values
        FROM (SELECT     SYS_CONNECT_BY_PATH (rtxt, ',') AS ptxt
                    FROM (SELECT key_value || '/' || VALUE AS rtxt,
                                 ROW_NUMBER () OVER (PARTITION BY profile_id ORDER BY key_value,
                                  VALUE) AS rnum
                            FROM sp_profile_detail
                           WHERE profile_id IN (100, 101))
                   WHERE CONNECT_BY_ISLEAF = 1
              START WITH rnum = 1
              CONNECT BY rnum = PRIOR rnum + 1) t
    GROUP BY ptxt
    MINUS
    -- staging
    SELECT   SUBSTR (s.ptxt, 2, LENGTH (ptxt)) profile_values
        FROM (SELECT     SYS_CONNECT_BY_PATH (rtxt, ',') AS ptxt
                    FROM (SELECT key_value || '/' || VALUE AS rtxt,
                                 ROW_NUMBER () OVER (ORDER BY key_value,
                                  VALUE) AS rnum
                            FROM sp_profile_detail1)
                   WHERE CONNECT_BY_ISLEAF = 1
              START WITH rnum = 1
              CONNECT BY rnum = PRIOR rnum + 1) s
    GROUP BY ptxt

  • How to get the parent and child relation of the group (______________)

    Please teach the method of acquiring the parent and child relation of the group with EDK5.2.
    EDK5.2____________________,_________o

    Hello.
    Java________,_______________...
    Class________o
    com.plumtree.remote.auth.ChildGroupList
    ...o(^^;)
    Best Regards,
    --------- Hiroko Iida_______ (05/10/28 18:27) -------
    Please teach the method of acquiring the parent and child relation of the group with EDK5.2.
    EDK5.2____________________,_________o

  • Insert data Flatfile table to Parent and child tables

    Hi All,
        I have Flatfile table which is we getting from daily txt files and i want to populate flatfile data to parent as well as child tables. parent table has primary key as ID. This ID is foreign key of child tables. 
    Here i have mentioned our process.
    1. Flatfile duplicates has to remove with condition of daily date.
    2. Before Insert parent table have to check duplicate(we have Unique key of 4 columns in parent) if duplicate is there we have to delete duplicate then Insert into parent table unique records(Primary key is ID).(here why we are delete duplicate record meaning
    we getting daily files so if any records updated in future that record should be insert to parent and child table so only we delete old records and insert new records).
    3.After insert parent we have to populate child tables from Flatfile table as well as we have to insert parent table primary key as foreign key of child tables.
    4. if any truncation error occurs that errors should go to error log table.
    Right now we are using cursor for this concept and cursor has performance issue. so we are trying to optimize other way to populate parent and child table to increase performance to populate.
    Please help us to which way to do this process increase of performance .
    Please  can any one reply.

    Hi RajVasu,
    Since this issue is related to Transact-SQL, I will move this thread to Transact-SQL forum. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. 
    Thank you for your understanding and support.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • OIM API - How to get the values in the process form (both parent and child)

    Hi,
    I created an RO with a Process form (both Parent and Child).I created a unconditional process task which takes in the processinstance key and tried to retrieve the process form datas.When i tried to provison the resource,the process task is getting triggered and I could able to get the parent form data but not the child form data.
    Any idea why is this happening?.Is it mandatory to have the "Triggers" ON to get the Child Form data.?
    Thanks,

    try this
    tcResultSet childResults = formOper.getChildFormDefinition(
                             formOper.getProcessFormDefinitionKey(procInstanceKey),
                             formOper.getProcessFormVersion(procInstanceKey));
    This should work,
    Regards,
    Raghav

  • How to update parent and child tables while updating parent table

    I have a parent table EMPLOYEE which includes columns (sysid, serviceno,employeename...) sysid is Primary key, serviceno is Unique key and I have child table DEPENDENT includes columns (sysid,employee_sysid,name,dob...) here again SYSID is primary key for DEPENDENTS table, employee_sysid is Foreign key of EMPLOYEE table.
    Now I want to change SYSID (using sequence) in EMPLOYEE table which need to be update in DEPENDENTS table as well
    Note: I have 10000 records in EMPLOYEE table as well as I have 5 more child tables which need to update new SYSID.
    please help me

    first disable the FOREIGN KEY Constraints.
    you can update Parent as well as Child record also with help of trigger.
    here i am giving you one examlpe..it may help u.
    create table parent(id number primary key,name varchar2(100))
    create table child_1(id number primary key,p_id number,dob date,
    CONSTRAINT FK_id FOREIGN KEY (p_id) REFERENCES parent (ID))
    create table child_2(id number primary key,p_id2 number,addr varchar2(1000),
    CONSTRAINT FK_id2 FOREIGN KEY (p_id2) REFERENCES parent (ID))
    insert some test data to parent and child tables.
    alter table child_2 disable constraint FK_id2
    alter table child_1 disable constraint FK_id2
    CREATE OR REPLACE TRIGGER delete_child
    BEFORE UPDATE ON parent
    FOR EACH ROW
    BEGIN
    UPDATE CHILD_1
    SET P_ID=:NEW.ID
    WHERE P_ID=:OLD.ID;
    UPDATE CHILD_2
    SET P_ID2 =:NEW.ID
    WHERE P_ID2=:OLD.ID;
    END;
    then Upadte parent table primary key col and check the child tables.
    then enable the constraints...

  • %variance between parent and child hierarchy

    Experts,
          How to calculate a percentage variance between parent and child hierarchy.
    Ex: parent is 80 and child is 20 so I need a %variance between 80 and 20.
    Thanks in advance.

    Hi Nikki
    Create structure and restrict parent hierarchy with one node and child hierarchy with another node and create formula node to calculate the percentage variance between two nodes.assign points if helpfful.
    Regards
    Murali.

Maybe you are looking for

  • Convert .img to .iso

    how can i covert a .img to a .iso, i have burn & i used the disk utility app but my virtualbox software can't boot from it.

  • Creating a dialog box with OK and Cancel buttons without OADialogPage

    Hi Experts, i want to create a dialog box for Delete Confirmation means after clicking on delete it should pop up a small dialog box with OK/Cancel buttons and need code for the same to handle the buttons. i have created with OADialogPage but its sho

  • Excel-VBA Macro Connectivity to XE

    I have an excel-macro which accesses data from Oracle9i database with the connection code; Set oOraSession = CreateObject("OracleInProcServer.XOraSession") Set oOraDatabase = oOraSession.OpenDatabase("iois", "bacc/password", 0&) It runs smoothly with

  • NWDS Installation on a 64-bit Windows 7

    Hi I'm working on a 64-bit Windows 7 System. Actually I'm using eclipse Helios to develop my Java Mappings. I'd like to use the SAP Netweaver Development Studio to create Java Proxies. So I downloaded the current version and run the Installer. Unfort

  • Mail Is Only a "MIME Attachment"

    I'm away from home trying to get by on an iPod touch standing in for a laptop. One e-mail I received, forwarded (at least) by one AOL user, consists of nothing but a "mime-attachment". I believe I've seen similar things in e-mail on Mail for OS X, bu