Query vs Toplink managed collection and cascade persist

A fairly simple situation: I have a 1-N relation which is managed by Toplink: 1 relation can have N calendars (I know, badly chosen class name, but alas).
If I access the collection through the Toplink managed collection, make a change to one of the calendars and then merge the relation, the change in the calendar instance automatically is detected and also persisted.
However, if I use a query (because I do not need all calendars) to find the same instance and make the same change, then it is not persisted. Appearantly the "cascade persist" is not done here.
There are a few ways around this:
1. fetch the original collection and by compare-and-remove emulate the query
2. do a setRelation(null) and then setRelation(xxx) of the relation
3. do a merge inside the transaction (a merge outside does not work)
The funny thing is, workaround #2 really sets the same relation again!
Is there a way to have the result of a query also cascade persist?

Well, I do not want to do it in a transaction, because then the changes are written to the database immediately and that will result in all kind of locking problems (this is a fat client situation). What want is fairly simple: the user modifies entities in an object graph in memory and at the end of his work either presses "cancel" and clears all changes, or presses "save" and stores all changes. When he presses "save" I expect the EM to persist every changed entity.
This approach works ok for all scenario's I have implemented up until now. The current one is different in that I get related entities not by traveling the object graph (so via Cascade.PERSIST collections), but via a query. There is one major difference between these two: the entities from the collections are automatically persisted, the ones from a query are not.. BUT they are -for all means and purposes- identical. Specifically: the collection gives me ALL calendars associated with the relation, the query only those from a timespan but still associated with the relation.
For some reason I expected the entities to also auto-persist, BECAUSE they also are present in the collection.
Ok then, so I understand that entities fetched through a query are unrelated to any other entity, even though they also exist in a Cascade.PERSIST collection. (I still have to test what happens if I, after the query, also access the collection: will the same object be present?)
That being as it as, I need to merge each queries entity separate and thus I expect the EM to remember any entities merged outside a transaction, but it does not. That I do not understand.
Now, I already have a patched / extended EM because of a strange behavior in the remove vs clear dynamics, so this was a minor add-on and works perfectly (so far ;-). But if you have a better idea how to remember changes to entities, which are to be merged upon transaction start... Please!

Similar Messages

  • TFS 2010: Query over all Collections and Team Projects

    Hi,
    is it possible to generate a query which queries all collections and team project on a TFS?
    For example if I want to know all work items assigned to me. Actually I can only query over a collection and not over the complete TFS.
    How can I do this?
    Thanks,
    Mat

    Hi Mat,
    Thank you for your post.
    You may need write a TFS API to list all team project collections in server. For detail information, you can refer to Taylaf's blog
    Retrieve the List of Team Project Collections from TFS 2010 Client APIs and Paul's blog
    List all TFS Project Collections and Projects.
    I hope this information will help resolve this issue.
    If anything is unclear, please free feel to let me know.
    Regards,
    Lily Wu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Problem while reordering a managed collection

    Hello,
    I'm trying to implement a feature that allows users to freely
    re-arrange items into a
    managed collection, using Drag and Drop. I'm using a
    TileList object, which already has built-in support for Drag and
    Drop, provided by Flex.
    A FDS destination (implemented by a Java class) is used to
    fill the collection with data (the fill method gets called).
    The problem is when the user tries to re-arrange the items in
    the list, using DnD. The Flex client sends to FDS a "delete"
    operation message, followed by a "create" one. I don't really want
    to do a "delete" and a "create" on the server side / (FDS's managed
    collection and the uunderlying database), as there's no really a
    delete and a create, it's rather a "move" sort of thing that should
    happen.
    What I want FDS to do is to ignore the list of changes
    ("delete" and "create") on it's sync method, somehow manage to
    re-arrange it's managed collection, and send an OK back to the
    client, without doing any auto-refresh. that is, I don't need any
    database trip to happen here for now.
    I'm having trouble making these to happen. I tried various
    approaches so far, with no success. Any ideas?
    Thanks,
    Robert

    don,
    Did you realise that your IntegerSet class isn't very useful?
    Why? you ask... Well the only change to the behaviour of java.util.HashSet is that your [add method|http://java.sun.com/javase/6/docs/api/java/util/HashSet.html#add(E)] throws IntegerAleadyExistsException, instead of just returning false.
    Rule of thumb: If you can return a meaninful value (instead of throwing an exception) then that's the way to go... because it simplifies the calling code.
    the return value solution ...
      if ( !set.add(item) ) {
        System.err.println("Item "+item+" allready exists. Guess again.");
    ... verses the exception solution ...
      try {
        set.add(item);
      } catch (ItemAleadyExistsException e) {
        System.err.println("Item "+item+" allready exists. Guess again.");
      }Which do you think is "cleaner" easier to maintain?
    Also: HashSet is generic (meaning that it can be used to hold a set of any-type) whereas your class is limited to holding Integers... so it's much less broadly "useful".
    You're writing this class for the learning experience, not for the usefulness of it, right? Cool... but it might be good for you (in the long run) to know that such a "limited" class is... ummm... a waste of code; and you should think about when to throw an exception, and when not to. Exception handling is an important and much-over-looked aspect of good system design.
    Cheers. Keith.

  • Can I create and manage collections in itunes instead of on the ipad?

    Can I create and manage collections in itunes instead of on the ipad? I have hundreds (maybe thousands) of PDF files for technical work items that I need to categorize and use on my ipad but it is a bit cumbersome to manually move them one at a time on the ipad.

    While you can add pdf files to iTunes it is not really intended to be used for organizing things other than a music collection.  It will only accept PDF files and media (audio, movie) files.  On the other hand if you can creatively come up with a way to make it work for you then go for it.

  • SAP B1 - Query on Collections and Payments

    Dear Experts,
    We are working on cash flow forecasting model, i.e going forward 12 months, which in written in MS Excel. We update it with actual data recorded in SAP B1 (Ver 8.8 PL18)  A manual process.
    Was wondering if we can get a single query written which will provide the following data:
    Collections and Payments to/from BP in a given time (user specified)
    BP Code
    BP Name
    Document Type (i.e receipt or payment)
    Document number the reciept or payment is related to to i.e the invoice that is being paid or receipted
    Date pf payment/receipt
    Amount
    Thank you in advance.
    Regards
    Raj

    Hi,
    Check this thread whether query meets your requirement:
    http://scn.sap.com/thread/3542905
    Thanks & Regards,
    Nagarajan

  • SQL query to list all collections, members, OS, SP, IP and if physical/virtual

    Hi guys, I have the below query which lists all the collections and their members, however I need to expand it to also include the OS, Service Pack, IP and if it's a physical or virtual machine.
    I've tried a few things but only made it worse. Is anyone able to expand the below code to include those extras??
    SELECT
    v_FullCollectionMembership.CollectionID AS 'CollID',
    v_Collection.Name AS 'CollName',
    v_FullCollectionMembership.Name AS 'SystemName'
    FROM
    v_FullCollectionMembership, v_Collection
    WHERE v_FullCollectionMembership.CollectionID = v_Collection.CollectionID
    ORDER BY
    CollID ASC, SystemName ASC

    Hi,
    These requirements could be found in several threads or blogs. We need convert WQL to SQL, and you can involve SQL guys to integrate the statements and format the result.
    How to create a all virtual machines collection.
    SCCM SQL Query - IP Address
    ConfigMgr Systems without Current Service Packs, and System Patch Status 

  • Apex Collections and dates

    Apex Collections and Dates
    I made an earlier posting today on the forum titled “‘ORA-01861: literal does not match format string’ error after my hosting company upgraded to Apex 3.2.” The issue relates to Apex collections and dates. Prior to the hosting company upgrading Apex 3.2 from 3.1 all was working OK. It seemed a reasonable assumption that the issue relates to the upgrade to 3.2. Having tested the code against another Apex 3.2 installation I am satisfied that the issue is not with Apex 3.2. That said, I am still getting the issue on the hosting site.
    To demonstrate the issue to my hosting company and this forum, I put together a simple one page application that demonstrates the issue using the least amount of code.
    I created a page with an ‘On Load – Before header” process that sets up an Apex Collection with a single value of ’20-FEB-2009’ in the c001 element as follows:
    if apex_collection.collection_exists(p_collection_name=>'THEISSUE') then
    apex_collection.delete_collection(p_collection_name=>'THEISSUE');
    end if;
    apex_collection.create_collection(p_collection_name => 'THEISSUE');
    APEX_COLLECTION.ADD_MEMBER(
    p_collection_name => 'THEISSUE',
    p_c001 => '20-FEB-2009');
    I added an SQL REPORT region to the page which uses the Apex Collection as follows:
    select to_date(c001,'DD-MON-YYYY') testdate
    from apex_collections
    where collection_name='THEISSUE'
    and to_date('20-FEB-2009','DD-MON-YYYY')
    = to_date(c001,'DD-MON-YYYY')
    When the page is run I get the ‘ORA-01861: literal does not match format string’ error.
    If I remove the following from the SQL Report Region:
    and to_date('20-FEB-2009','DD-MON-YYYY')
    = to_date(c001,'DD-MON-YYYY')
    and run the page, the date is displayed OK, i.e., c001 is converted to a date OK. This made me wonder whether it does not like the line to_date('20-FEB-2009','DD-MON-YYYY')? So I changed the where code for the report to :
    and to_date(c001,'DD-MON-YYYY')
    = to_date(c001,'DD-MON-YYYY')
    i.e., convert c001 to a date and compare it to itself. The rationale being that if the c001 converts to a date OK, then comparing c001 converted to a date with itself should not give an error. It did it gave the same error ‘ORA-01861’
    It would seem on my hosting site since the upgrade, that Apex and Oracle have problems with Apex Collection elements being converted to dates as part of the where clause.
    Now my understating of Oracle Apex collections in simple terms is that all Apex collections are held in a single Oracle table managed by a series of Apex functions. Given that all Apex collections are in the same table, could the issue be with the Oracle database when it is creating its execution plan for the query? Could Oracle be including the value of c001 from other collections (i.e., when c001 is not in a date format ) in the initial stages of its execution plan?
    I hope the above make sense and thanks in advance.
    Ian

    Scott,
    I believe I have found the answer the statistics on WWV_FLOW_COLLECTIONS$ and WWV_FLOW_COLLECTION_MEMBERS$. are out of date and Oracle is doing a full table scan instead of using the indices to select only the c001 columns that belong to the given collection_id. If I change my simple example to store the date value in c050 it works ok. (In all probability this will be the only collection on the hosted database to use c050).
    I have asked the hosting company to gather stats on all the apex tables.
    Thanks for your help
    Ian

  • Cannot manually manage music and videos without erasing and syncing first

    I have an iPhone 3G bought new from the Apple store using 2.1. Using iTunes 8.0 and checking the "Manually manage music and video" checkbox, iTunes prompts me to "Erase and Sync", no other option is available to me. It was the same when using version 7.7 as well.
    I'm not syncing to another computer, it's the same MacBook I've had for almost a year. How do I get the Library Persistent ID in iTunes to match the iPhone. I have the ID from the iTunes Music Library.xml file. I just need to know where the matching file for the iPhone is so I can make them match.
    The ID doesn't match because I had to rebuild my drive a month ago and my question to Apple (actually Steve) is why can't I sync the other way from the phone to the computer.
    Why does my library on the phone have to be wiped out. Who had the warped thought to come up with this genius idea.
    Message was edited by: ep1curus

    I cannot express how disappointing this was for me to find out.
    I want my music to be mobile, I don't want to have to copy it to every computer I want to listen to it on. I want to listen to it from the device, and be able to buy a new album at work or at home. This is a major disappointment for me, as every other device I have owned including my iPod Touch had this capability. I could authorize 5 machines and manually sync, and the music on that device could be played and managed on those authorized machines. For example, my wife has her own music collection, and I have mine, but we have a media center connected to our flat-screen in the living room, that we use for playing music when we are entertaining guests, and with our old iPods and iPod Touch devices, we could unplug one of our devices and plug the other persons in and listen to music from both our libraries without copying the music to that computer, as long as we authorized that machine for the both of us. Now with our iPhones there is no way to keep our seperate librarys and be able to play music on multiple computers in our house and at work, which we have always been able to do until our iPhones. The whole point of the iPhone for me was to be able to combine two devices and now because of the lack of this feature I still have to keep all our iPods around too... Dumb. I almost took our phones back because of this, and if apple doesn't fix it, I probably won't buy another. They should have at least mentioned this little fact before selling the devices to us. I know it's a different device, but it's similar enough that you expect it to work the same as the iPod and iPod Touch. It's not like I am wanting to be able to copy music from the device to multiple machines, it's exactly the opposite... I just want to be able to copy music to the device and listen to it at home and at work... why all apples other devices do this, and the iPhone doesn't is completely perplexing to me, and a serious oversight on there part. This pill would not be so hard to swallow if I had been warned about this prior to dropping almost a grand for iPhones for myself and my wife, expecting what I saw as a more advanced device to work at least as good as the other similar devices I own did.

  • Privately Owned and Cascade Delete in DB

    HI,
    What is the relationship between setting privately owned in Toplink vs creating a cascade delete in Oracle DB? If I've the cascade delete in DB then what is the advantage of setting the privately owned flag in toplink?
    Thanks

    If you only set the cascade delete option in the database, then TopLink will have no knowledge that the private object was deleted (or that it is private in general). This would mean that TopLink would not remove the private object from the cache or process it as have being deleted. In general this may not cause your app any direct issues if you never read the private object directly as it will eventually garbage collect from the cache.
    Making the relationship privately own in TopLink will also ensure the following:
    - If you replace the private object with another, or set it to null, TopLink will delete the old object on the update of the source. Cascade delete only works on deletion.
    - If the relationship is a 1-m and you remove an object from the collection it will be removed.
    - If you refresh the parent object, by default the child will also be refreshed.
    - If you merge the parent object, by default the child will also be merged.

  • Interface suggestion for Collections and Presets windows

    Hi,
    I would like to suggest you an improving of the left part of the main screen. I wish - maybe one day - that you can modify the management of collections, presets, etc...
    When you have a lot of Presets and Collections, and we need to switch between them asap, it's very difficult to scroll all of the list (...the scrollbar is also on the left ! Strange idea...)
    The best idea will be to redraw the actual design : in that case, the title bar and their "contextual menu" still always visible.
    A simple mouse clic would allow to uncollapse Collection or Presets lists very quickly on the top. All titles won't be never hidden.
    Please, take a look at my screen capture (my suggestion) for a better explanation.
    Thanx.

    Hi thanks for help,
    The thing is, I need all the data if the user wants to see Details, then I will need to display all rows. On the other hand, Sybase doesnt have the stdev function, I wrote a query that calculates stdev, but I will need to run the query once for each person, because it looks like this:
    select
    (SQRT((sum((MyFieldName - (select convert(dec(10,2),avg(MyFieldName))
    From MyTableNameWhere
    MyWhereCriteria and
    abs(MyFieldName)>0))*(MyFieldName - (select convert(dec(10,2),avg(MyFieldName))
    From MyTableNameWhere MyWhereCriteria and abs(MyFieldName)>0)))) /(select count(MyFieldName)-1
    from MyTableNamewhere MyWhereCriteria))) 'StDev'
    from MyTableName WHERE MyWhereCriteria
    where MyWhereCriteria would be
    where date = '07/03/2009' and name = 'John'
    so some of the subqueries return multiple rows which is a problem..
    I got error saing:
    [Error] Script lines: 13-30 ------------------------
    Subquery returned more than 1 value. This is illegal when the subquery follows =, !=, <, <= , >, >=, or when the subquery is used as an expression.
    Msg: 512, Level: 16, State: 1

  • Issue in EHP5 Talent Management (Team Goals) Cascade goals functionality

    Hi Friends,
    Issue in EHP5 Talent Management (Team Goals) Cascade goals functionality.
    Under Team Object While try to cascade goals, it pop-Up Warning Msg u201CChoose Save to save the goal in the employee document. The goal can no longer be deleted, only set to obsoleteu201D.
    If we click Ok to proceed further, I am getting error stating u201CYou have made no selection" and " No appraisal template defined ".
    Same functionality is working fine in u201CPerformance Management (Predefined)u201D
    With Regards
    Seranjeeve Kumar

    Please  set the parameter PROCESS "PMP" in the iview configuration.
    ie
    ROLE_ID=PA&PROCESS=PMP in application parameters
    content provided by SAP ->
    specialist ->
    Talent management Specialist ->
    iViews ->
    COmpany goals etc
    and you can confirm using this
    CL_HAP_CASCADE_GOALS > meth0d GET_VALID_APPRAISAL_TEMPLATES
    The parameter mentioned in the note 1457057, the one that you enter in
    transaction SE80 is the default value. However, if you call application
    with parameter PROCESS=PMP then the PMP process for cascading goals will
    be used.
    check note  1523527

  • Compatibility issue between your power management system and Windows 8.1

    I have purchased a new Lenovo Ideapad S410 and have this problem.
           Compatibility issue between your power management system and Windows
           It also gives a message "Your PC ran into a problem and needs to restart. We're just collecting some error info, and then we'll restart for you. (100% complete)
           If you'd like to know more, you can search online later for this error:
    VIDEO DXGKRNL FATAL ERROR
    Please help! My laptop is only 5 days old.

    What model do you have? Can you post your MTM or model name?
    Sometimes these messages are a false alarm.

  • Trouble with loading videos - Manually manage music and videos not supported now with iOS5 and a 1st gen iPad?

    Since updating my iPad 1st gen to iOS5.0.1 videos don't get loaded properly into the Videos app.
    On the Summary page in iTunes of my docked iPad, I have always checked the box for "Manually manage music and videos".
    I have my reasons for doing it this way, but that's for another thread perhaps.
    The problem is that when I load a video to my iPad this way - by simply just dragging it from the desktop and onto the iPad, under Devices in iTunes - it copies/updates, and shows up on the iPad like it always has before iOS5. But now, with iOS5, when I undock, it can't be found anywhere within the Videos app on the iPad. The only way I can find it is to do a Search, which seems to find it, but when I click it, a different video plays - the first video in the Movies list in the Video app. Dock the iPad again, yes the video is there, according to iTunes, but no way to play it once iPad is undocked.
    My suspicion is that with iOS5 you are no longer able to use the "Manually manage music and videos (Mmm&v)" that you will be forced to run everything through iTunes - and probably iCloud. I've unchecked the Mmm&v box, and get prompted with "Are you sure? - All existing content on the iPad will be replaced with content from your iTunes library". READ - "Rebuild your entire video and music collection, and this time run it all through iTunes. Welcome to iOS5. Have a nice day or two wasting your time rebuilding your entire video and music collection. Don't fight it. Use iTunes for everything! Until we finally make iTunes a decent piece of digital media management software, then you'll have to do it all again."
    Okay, rant over - Anyone out there with running iOS5 on a 1st gen iPad with the Mmm&v option checked and able to load a video manually (not through iTunes)? Any other thoughts?
    Thanks

    Yea, i managed to fix my issue in a wild fashion way But I DONT suggest it to anyone.
    I like to hear why it happened after upgrading iTunes and if there is any peaceful solution.
    Bythe way, here is how i fixed it :
    1-i checked "manually manage music and videos" checkbox and clicked on "Sync" button
    2-It showed a threating message that it will erase my music and videos ,......
    3-I clicked on OK button and let iTunes do any thing she said , but the second it started to delete my treasures from my iphone, i disconnected my phone by pulling USB cable.
    Now i have my musics and videos untouched and got that Option enabled again and i can manage my Music/Videos and Books manually.

  • "Manually manage music and videos" takes up more space than syncing?

    Hello all,
    I fear that I am just stupid and unseeing an obvious answer to this query, but ask I shall, because it is frustrating me to no end.
    I recently downloaded a few audiobooks from my local library to listen to on my iPod Touch; the app in question requires that you "manually manage music and videos" rather than syncing. Fine.
    I switch over to iTunes, check the box, and now my music--without changing anything, mind--is now taking up an additional 1.8 (or more) gigs on my iPod. I toggle the option to "manually manage" on and off, and with it "on", my music takes up more space than with it "off", even though it's the same music, same podcasts.
    Can someone please explain to me why syncing manually takes up more space than syncing automatically and where the extra gigs are coming from? There's not that much audio on my iPod--1.52 gb of music, 1.97 gb of podcasts and .69 gb of apps--which only adds up to 4.18 gb, and on an 8g touch, should leave me with about 4 gb of "wiggle room", so to speak, rather than .27 gb.
    Help, please!

    iTunes will normally put just one copy of each file on the iPod and link it to multiple playlists. If your iPod's database has been corrupted at some point however, there may be unattached copies of your meadia from earlier sync attempts, taking up space on the drive, but not visible in the library. How much space does iTunes report for Other? Excluding files placed manually & intentionally on the iPod, "other" is typically an overhead of 1%-2% of the size of the media and represents the iPod database, artwork, games etc. If you have significantly larger amounts of "other" then you will need to restore your iPod in order to reclaim the space.
    tt2

  • Query on Time Management Status

    Dear Team,
    Scenario:
    We have some employees wherein the time evaluation will be evaluated for the status of 9 in Planned Working Time Infotype. After a period of time, these employees will be sent for education and no leaves are entitled. In this case, the time management status will be changed to 0. No time evaluation.
    The accrued leaves will still be available for the employee while going to this education for example 20 days.
    We have customized a rule, which will carry forward the last year balance to the current year balance on every 1st of the year.
    In the above case, if an employee completes his education and returns back in the middle of the year other than the 1st day of the year, in this case, the carry forward of leave is not taking place.
    My assumptions:
    I would like to know an operation which would query the Previous Day Time Management Status and Current Day Time Management Status. If I can able to do this, if it is YES, the last old previous balance to be carried forward....
    Please let me know if any other alternative method.
    Thanks and Regards
    Team Member.
    Edited by: Patlolla Mallikarjun on Apr 26, 2010 8:35 PM

    Hello Mallikarjun,
    If you are planning on controlling thru a rule in schema, you can approach this way. Whenever an EE returns from education, change IT0007 time mgmt status to 9 along with additional time indicator say 'ED'. You can query the additional time indicator status in a rule thru the operation 'OUTWPATIND'. Hope this helps your requirement.
    Best Regards,
    Sunny

Maybe you are looking for