Insertion using objects and update using queries in a single unit of work

HI All,
I have a set of objects that i want to insert and then perform some update queries ( direct queries ) on the inserted data in the same transaction. but when i register the objects and execute the update SQL's on the same data in a same unit of work, the update statements are executed first and then the inserts are happening, I've also tried with child unit of work and parent unit of work but the result is the same.
Can any one suggest a way to do object insertion and sql updates in a single transaction, Thanks in advance
Regards,
Sai Krishna

The UnitOfWork is an abstraction for the physical database query. By default nothing is actually written into the database until the UnitOfWork commits. This means making updates to new objects involves modifying them in-memory and then the updated values will be included in the INSERT during commit.
If you are having difficulty finding the newly created objects you can enable the query conforming capabilities to have modified and new objects included in query comparisons without requiring them to first be written to the database.
Doug

Similar Messages

  • HT201270 hi i wanna ask if the update carrier update could affect if i insert another sim and update it..im using softbank but soon i will go back to philippines i wanna use philippine sim,is it possible ? than you

    hi i wanna ask if the update carrier update could affect if i insert another sim and update it..im using softbank but soon i will go back to philippines i wanna use philippine sim,is it possible ? than you

    Softbank does not offer unlocking at all. You can not use that phone with another carrier. Sell it before you leave and buy one you can use in the country where you intend to use it.

  • Airplay icon on ipad is gone, trying to play spotify on my ipad and use airplay  to the Bose unit, it worked yesterday, but today the airplay icon is gone , how do I get it back

    airplay icon on ipad is gone, trying to play spotify on my ipad and use airplay  to the Bose unit, it worked yesterday, but today the airplay icon is gone , how do I get it back

    I just had the same problem. Took the first unit back and the problem is still occuring on the second one. I solved it by setting up again with the USB, but it keeps dropping out every few days.

  • I downloaded iOS 7 onto my iPhone 4 and updated the iTunes on my PC, WiFi connection works but somewhow it won't do anything when I plug the iPhone.

    I downloaded iOS 7 onto my iPhone 4 and updated the iTunes on my PC, WiFi connection works but somewhow it won't do anything when I plug the iPhone. Now, I got frustrated that neither iTunes nor my iPhone do anything. I need my iPhone to get it back to work regardless if it's back to the last version of iOS.

    I just encountered this problem for the first time and stumbled upon this forum to find a solution.  I played around with it a bit and it seems that if you slide your finger from the bottom up, you will come upon that new screen that will allow you to do various functions with your phone (put it in airport mode, lock, etc.), you can select your Airport from this screen and play your music wirelessly from your phone; at least this was my experience. Hope this helps!

  • Insert one table and update another???

    Hello,
    I was wondering if it is possible to insert a record in one table and update another another record in a different table.
    I have a form on my company's intranet that allows employees to add comments (ADDT Insert transaction) about new products we are going to bring to the market. At the same time, I would like to count the numbers of comments on a particular product and update that number for each product to see which product is getting the most reviews.
    Right now the products are on the homepage with the title and inserted date. From there, the employees click on the product get the info and make comments about it. The problem for me is that I would like to see the comment counts for each product on the home page, which means I would have to update the product table with the count.
    Sorry, I am using PHP as the technology.
    When I used to do it in ASP, I would insert the comment using the POST from the form, but add another hidden field with the count in it and I would use the "Command" Server behavior to retrieve the number and update the other table field.
    I noticed that dreamweaver removed the "Command" server behavior when using PHP.
    All help is greatly appreciated
    Charles.

    Hi Charles,
    you can generally execute queries on a different table using Custom Triggers, and in regards to your "update the product table with the count" scenario the ADDT help file has a helpful pointer in the chapter "Custom transactions and triggers : Save additional information on login" -- in here you´ll find a sample "incremental counter" query which should be easy to adapt.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Syntax for Merge statement to insert into target and update source

    Hello All,
    I want to use Merge statement to insert records when not matched in my target and update records in source when matched. Is it possible to do using Merge statement.
    create table a (aa number)
    create table b (bb number)
    alter table a add flg char(1)
    merge b as target
    using a as source
    on (target.bb = source.aa)
    when matched then
    update set source.flg = 'Y'
    WHEN NOT MATCHED THEN
    insert (target.bb)
    values
    (source.aa)
    Thanks.

    Hi,
    I have no idea about the version of DB, else some new features with respect version can be specified - just for informaitve purpose and to post across the verison of DB in future posts.
    Coming to your issue and requirement.
    if you check the syntax and functionality , then its on Merge on target base only - with respect to Update (matched o columns) and insert (for unmatched columns). Source - as the term is clear. It might not work out on source table.
    - Pavan Kumar N
    - ORACLE OCP - 9i/10g
    https://www.oracleinternals.blogspot.com

  • Activation of BW Production Objects and Transport of Queries and Work books

    Hi,
    I have successfully transported 0FIGL_1 InfoCube (only in Data Flow Before) from BW DEV to BW Production...
    But In BW Production This Cube and InfoSources and Update rules and InfoObects are all in inactive...
    What to do?..
    Please tell me step by step procedure.....
    and also suggest me on how to transport Queries and work books related to My 0FIGL_1 Cube...
    Please tell me all step by step procedure...
    Help will be greatly appreciated..
    This is very urgent
    Thanks in advance...

    Hi,
    May be you are telling is correct but i am unable to follow..
    Please correct if my understanding is wrong....
    1. I have Created one BEx Truck Request...it is not Released so far..So, it is there in SE09 of BW DEV
    2. Selected Queried and work books --- Grouping --- Only necessary objects -- Collection mode -- automatic...(Default all queries and workbooks selected as check box)
    3. Click Transport truck (Which is beside of Grouping Option)..
    4. Created one request and then released... But not imported into BW Production..
    5. Now I have modified all the queried (Change text)
    6. RSA1 -- Transport connection -- Selected modified queried...
    7. Grouping only necessary objects and collected mode --automatic...
    8. Selected modified queries and dragged into right side...
    My question here is they are not checked check box under transport?...shall i check it?
    Shall i release Old BEx Request? and then before transporting these new modified queries Create another BEx Request?
    or else..
    Create new request for modified Queries? and then transport?
    Now the situation is i have already created transport request for modified queries..What to do? shall i release them also?...
    Pls suggest me....

  • Quick time player doesnt start any more since kernel shock and update, the symbol looks different, reinstallation doesn´t work

    hi there.
    I am using a Macbook Pro with snow leopard and this is my problem:
    I was having a Kernel Shock 2 weeks ago. After that, my Finder-Dashboard hasn´t work any more. I´ve did the latest update. Now Dashboard Works but Quick Time Player doesns´t do.
    I Can´t find NOWHERE in the internet an installation file for Quick time player to reinstall. And I can´t find my Installation DVD.
    quicktime has changed his symbol to an white picture with pensil and brush.
    I have made a second Account and activeted the guest accounts and tryed there, but Quick time player isn´t here working to.
    its really sad that this program doesn´t run any more.
    It blinks 2 times in the dock and shut down immediately.
    Can someone please help me? is my only opinion finding the Disc?

    I've tested that on an iPad 1 and it seems problem is performance related. On this device a simple click to a google search result link doesn't work properly. You hit the target multiple times and sporadically it opens. You still see the focus on the object and it's activation but no event triggering happens.
    All others functions are working well, only Webapps and Webpages suffer from this issue.
    The owner of the device has not recognized that issue and believed it is a "feature" not a bug as he do not has much experience with Apple devices. But this confirms it is on every device and not my own personal one or dedicated to our office. The only workaround is to use other devices or touching links with different speed/pressure. It works better if you hit the objects very quick lifting the finger immediately.

  • Timeout error while reading and updating in batches in a single transaction

    Problem:-
    In a transaction I do read and update to the database in batches. First batch it runs fine and for second batch it get hanged at
    sqlCommand.ExecuteReader(). The following is not my complete code but required bits of it which will give more information about the problem. At the end of this post please find the error log. Please help me.
    My guess:-
    The problem i see here is with the locks acquired while reading and update still remain when it comes for the second batch which is blocking the next read. But could not find a way to solve it.
    Get connection and open it.
    Begin Transaction.
    sqlUpdateTransaction = sqlUpdateConnection.BeginTransaction(String.Format("UpdateUsageDetailTransaction{0}", storageClassId))
    Get application lock.
    GetApplock
    const String sqlText = @"DECLARE @result int EXEC @result = sp_getapplock Resource=@resourceName,@LockMode='Exclusive',@LockOwner='Transaction',@LockTimeout=@timeout select @result";
    using (SqlCommand sqlCommand = sqlTransaction.Connection.CreateCommand())
    sqlCommand.CommandText = sqlText;
    sqlCommand.Parameters.AddWithValue("@resourceName", resourceName);
    sqlCommand.Parameters.AddWithValue("@timeout", milliSecondsTimeout);
    sqlCommand.CommandTimeout = secondsTimeout;
    sqlCommand.Transaction = sqlTransaction;
    Int32 lockResult = (Int32) sqlCommand.ExecuteScalar();
    Seek and read the range of records.
    using (var sqlReadConnection = new SqlConnection(_connectionString))
    sqlReadConnection.Open();
    SqlTransaction sqlTransaction = _sqlUpdateTransaction;
    _cdrList = CdrOps.FetchByrecordsIdRange(_yearMonth, firstSkid, firstSkid + count - 1, sqlReadConnection);
    sqlReadConnection.Close();
    return _cdrList.Count > 0;
    static public Dictionary FetchByrecordsIdRange(Int32 yearMonth, Int64 startCdrId, Int64 endCdrId, SqlConnection sqlConnection)
    Dictionary cdrList = new Dictionary();
    using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
    sqlCommand.CommandText = "EXEC P_GetCDRData @yearMonth, @startCdrId, @endCdrID";
    sqlCommand.Parameters.AddWithValue("@yearMonth", yearMonth);
    sqlCommand.Parameters.AddWithValue("@startCdrId", startCdrId);
    sqlCommand.Parameters.AddWithValue("@endCdrID", endCdrId);
    sqlCommand.CommandTimeout = DbOps.TwoHourTimeoutValue;
    using (SqlDataReader sqlDataReader = sqlCommand.ExecuteReader())
    FetchrecordPieces(sqlDataReader, cdrList);
    return cdrList;
    Update the records to the list by using a loop Go and check if the number of records read is equal to the batch size then write and flush.
    update()
    _tollUpdatedList.Add((Toll) record);
    _legacyUpdateCount++;
    Dispose.
    Dipose()
    if (_sqlUpdateTransaction != null && _sqlUpdateTransaction.Connection != null)
    sqlUpdateTransaction.Rollback(String.Format("UpdateUsageDetailTransaction{0}", _storageClassId));
    _sqlUpdateTransaction.Dispose();
    _sqlUpdateTransaction = null;
    Commit.
    commit()
    if(_sqlUpdateTransaction != null)
    _sqlUpdateTransaction.Commit();
    _sqlUpdateTransaction.Dispose();
    _sqlUpdateTransaction = null;
    Error log.
    Error: [0x80004005] MonthlyFileDb::Seek - Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

    Thank you, I used beta_lockinfo and observed the following
    spid=59/0/2
    command = SELECT  
    appl=.Net SqlClient Data Provider
    hostprc= 3640
    dbname = DEV_ECAP_P_CAP_ENT_CMN
    prcstatus= SUSPENDED
    spid_ =
    59/0/2
    blklvl = 1
    blkby = 55
    rsctype = 
    locktype =
    lstatus =
    ownertype =
    rscsubtype =
    waittime = 785.139
    waittype = LCK_M_IS
    spid__ = 59/0/2
    nstlvl = 3
    inputbuffer = (@yearMonth int,@startCdrId bigint,@endCdrID bigint)EXEC P_GetCDRData @yearMonth, @startCdrId, @endCdrID
    current_sp = DEV_ECAP_P_CAP_ENT_CMN.dbo.P_GetCDRData
    spid=55
    command = NULL
    appl=.Net SqlClient Data Provider
    hostprc= 3640
    dbname = DEV_ECAP_P_CAP_ENT_CMN
    prcstatus= sleeping
    spid_ =  55
    blklvl = !!
    blkby = 
    rsctype = APPLICATION
    locktype = X
    lstatus = grant
    ownertype = transaction
    rscsubtype = 
    waittime = 
    waittype = 
    spid__ = 55
    nstlvl = 
    inputbuffer =UPDATE UsgDetailCommon SET RunId = t2.RunId FROM UsgDetailCommon t1 INNER JOIN #UsgDetailCommon_Update t2 ON t1.YearMonth = t2.YearMonth AND t1.CdrId = t2.CdrId ;DROP TABLE #UsgDetailCommon_Update
    current_sp = 
    But what is the solution for this...? I am googling and I found similar post but with no solution, here it is not allowing me to post html link 

  • Insert a field and update the same row.

    Hi,
    I am inserting a value in a row.
    And later within a cursor loop I am trying to update the same row. But it is not working....
    CREATE OR REPLACE procedure Del_Note_stage
    Is
    v_delNote Delivery_Note.Delivery_Note_id%type;
    Cursor C1 is Select Heading_Name,File_Data from Sqlload_Stage;
    Begin
    dbms_output.put_line('i am here a ');
    Select Delivery_Note_Id_Seq.nextval into v_delNote from dual;
    Insert into DELIVERY_NOTE_STAGING(Delivery_Note_ID,LUT,LUB,PROCESSED) Values(v_delNote,sysdate,'Config','N');
    commit;
    dbms_output.put_line('i am here b'||v_delNote);
    For sqlload_rec in C1
       Loop
        dbms_output.put_line(sqlload_rec.Heading_Name);
        dbms_output.put_line('Del Note Id is :'||v_delNote);
        update DELIVERY_NOTE_STAGING  set deployed_by='TOM' where delivery_note_id=v_delNote;
    End loop;
    End;

    But it is not working....Why not?
    Please read: http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html
    Why are you updating after inserting?
    Just add deployed_by to the insert statement, or use a default value for that column.
    Also you don't need to select your Delivery_Note_Id_Seq.nextval from dual, just use it in your insert statement.
    Something like:
    Insert into DELIVERY_NOTE_STAGING(Delivery_Note_ID,LUT,LUB,PROCESSED,deployed_by )
    Values( Delivery_Note_Id_Seq.nextval,sysdate,'Config','N', 'TOM' /*or USER*/);

  • Tracking objects and updating a table

    Hi,
    I have 12 programs and whenever i run any of the programs a ztable shoud be updated (created by me) with program name , rundate and no of times it is executed.
    This functionality should be written in a separate fumction module.
    so could any pls send me some sample code for this
    Thanks in advance

    Hi,
    CALL FUNCTION 'z_update_fm'.
    EXPORTING
      repid = v_repid
    check for any entry in table ztab with repid.
    IF sy-subrc NE 0.    "entry does NOT exist in the table
      wa_ztab-rundt  = sy-datum.
      wa_ztab-repid  = v_repid.   " prog name
      wa_ztab-count = 1.
      APPEND wa_ztab TO it_ztab.
      CLEAR wa_ztab.
      IF it_ztab[] IS NOT INITIAL.
        INSERT ztab FROM TABLE it_ztab.
      ENDIF.
    ELSE.
      UPDATE ztab SET rundt = sy-datum
                           AND count = wa_ztab-count + 1
                     WHERE repid  = v_repid.    " prog name
    ENDIF.
    regards,
    teja.

  • I cannot restore and update my ipod touch in itunes. its not working at all

    plzzz help

    Need more info:
    What happens when you try?
    Error messages?
    What model iPod and iOS version?
    What computer OS and version
    What version of iTunes.

  • HT203164 Cannot print CD Jewel Case Insert using Windows 7; iTunes print options work fine from Windows XP; using iTunes print option CD Jewel Case Insert with Windows 7 prints jumbled mess?

    Cannot print CD Jewel Case Insert using Windows 7.  iTunes print options work fine with Windows XP, but attempting to print CD Jewel Case Insert from Windows 7 yields jumbled mess.

    I'm having the same issue - when I try to change any print options iTunes freezes and I have to end the process in Task Manager... I was trying to turn off duplex printing and the printer option screen wouldn't take any input. I changed the default printer properties to turn off duplex; iTunes did not reflect the updated preferences. It looks like there is an unknown issue with the printer setup module - guess that doesn't get much use anymore or Q/A should have picked up the issue...

  • Memory leak/overload when looping by index over a large query and updating each DB record

    I am importing a CSV file into a temporary table and then running a select query that joins my actual database table with the temporary table, looking for any changes in the data. If changes exist, the select query is looped from 1 to #recordCount# and an update is applied to each record via cfquery. It runs very quickly (much more quickly than looping the query itself), but my memory spikes and overloads after about 1500 updates are completed. I need to be able to do upwards of 20000 at a time, without killing my system. I have tried manually setting the runtime garbage collection to trigger after X number of loops, but that doesn't seem to help. I am running CF8. See below for loop example:
    <cfloop from="1" to="#updatedRecordsQuery.recordCount#" index="a">
    <cftry>
                    <cfquery datasource="#db#" name="doUpdate">
                        UPDATE
                            CI
                        SET
                            firstname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.firstname[a]#" />,
                            lastname = <cfqueryparam cfsqltype="cf_sql_varchar" value="#updatedRecordsQuery.lastname[a]#" />,
                            etc, for about 15 various fields
                        FROM
                            client_info CI
                        WHERE
                            CI.client_id = <cfqueryparam cfsqltype="cf_sql_integer" value="#updatedRecordsQuery.client_id[a]#" />
                    </cfquery>
                    <cfcatch type="database">
                        <cfset local.updateErrorList = listappend(local.updateErrorList,updatedRecordsQuery.client_id[a]) />
                        <cfset local.error = true />
                    </cfcatch>
               </cftry>
    </cfloop>

    I would suggest to use select update instead of looping over query object and update each row one-by-one.
    Procedure:
    - Insert your CSV data into temp table.
    - Use a select update SQL query to update the changed data instead of looping over a select query.
    Example:
    UPDATE
       Table
    SET
       Table.col1 = other_table.col1,
       Table.col2 = other_table.col2
    FROM
       Table
    INNER JOIN
      other_table
    ON
       Table.id = other_table.id
    NOTE: You can put all your scripts in a Procedure.

  • How to share and update one iTunes master library on an external HD between an iMac and iBook

    Hi.  I am in the process of consolidating and switching gears from storing my iTunes libraries (which have roughly the same files) on both my iMac and iBook (both OS 10.7.5) to creating one master library on an external hard drive (Canvio Connect 2TB) and sharing that between both computers, updating the laptop (which I use less frequently) when necessary. I wanted to know if this is possible and if so, how to go about doing this in a way where I don't lose any data and am able to maintain it efficiently.  Thanks!

    There is a library file on the external drive that contains a list of all the tracks you have put into iTunes.  The list points to media files iTunes plays are on the external drive too.  Using the instructions I provided you tell the iTunes application on each computer to start up using the library file on the external drive.  If you add a file to iTunes while using computer #1 the file will be copied to the media folder on the external drive and the library file on the external drive will be updated to show there is a new file.  When you plug the same drive into computer #2 and start iTunes it takes the file listing from the library file on the external drive.  You are using the one library with each computer and it exists only on the external drive which both computers use.  They are truly sharing the same single copy of the  library.
    I have a box with objects inside and a list inside with an updated inventory of the objects. I give the box to you. You take some objects out and put some in and make a note in the list of what you have done, then put the list back inside and hand the box to me.  How do I know what changes you have done?  Simple.  I open the box and look at the list.  It's the same list that was in your hands only moments before.  I add a few objects and update the list, put it back inside the box and hand the box to you.  How do you know what changes have been made? Simple.  Open the box and read the list which was the one I updated moments before.  The only copy of the list is in the box so neither of us is needing to keep our own copy of the list updated.
    Everything iTunes needs to generate your library listing is in the iTunes folder, but it doesn't have to be on the computer.  In your case it will all be on the external drive and each copy of the iTunes application on each computer will look and use the same identical library file on the external drive as you pass it from computer to computer.  Once you have set this up you can delete the entire iTunes folder in Music from your computer because the application will no longer be using it.  The only thing "iTunes" left on the computer will be the application itself, but each copy will have been told to use the library on the external drive.
    Okay, enough.  I've said the same thing about 4 ways now.

Maybe you are looking for

  • Error on creation of a view

    i have a norma view like this CREATE FORCE VIEW USERBO.USERPROFILE_VIEW (ROW_ID,EMPLOYEE,RESPONSABILITY_ID,RUOLO,E_USERNAME,E_PASSWORD,USERTYPE,USER_ID) AS SELECT RESPONSABILITYUSER.row_id, client.surname || ' ' || client.NAME, RESPONSABILITYUSER.res

  • Event Source: Application Error Event ID: 1000 (F1Server.exe)

    Hi. We regulary have an Application Error with "faulting module ntdll.dll" (see below). And we can't find what is the problem. Can you help us?  Windows Server 2003 R2 Eneterprise Edition Service Pack 2 [boot loader] timeout=30 default=multi(0)disk(0

  • Can Automator do this? (Move folder and THEN import to iTunes)?

    I want to drop a music folder on a droplet and have it automatically moved to my Music directory and then the files in that moved directory added to iTunes. I do not want to have iTunes manage my music files for a number of reasons. I tried to do it

  • Windows Server 2008 R2 - System State Backup - Application Log: CAPI2 513

    When performing a system state backup from wbadmin, I get... Creating a shadow copy of the volumes specified for backup... Creating a shadow copy of the volumes specified for backup... Please wait while system state files to back up are identified. T

  • Cisco Call Manager 9.1 on UCS E

    Hi Community. Does any one know if the Cisco Call Manager 9.1 is supported on UCS E? i already checked the documentation on cisco.com, but i just found something about the CCM 8.6 is supported but i didn't see any guide installation. Please help.