Remove privately owned object: SQLException: cannot update ... to NULL

I have a toplink descriptor called ToplinkRelationshipInfo which has a one-to-many mapping to a descriptor called ToplinkRelationshipAttribute. The mapping is privately owned and uses a foreign key from ToplinkRelationshipAttribute.info_id -> ToplinkRelationshipInfo.id. The ToplinkRelationshipAttribute has a one-to-one mapping back to the ToplinkRelationshipInfo.
The toplink generated Java source for ToplinkRelationshipInfo has a removeFromAttributes method:
public void removeFromAttributes(ToplinkRelationshipAttribute aToplinkRelationshipAttribute) {
     this.attributes.remove(aToplinkRelationshipAttribute);
     aToplinkRelationshipAttribute.setRelationshipInfo(null);
}When deleting/removing one of these attributes, if I simply call the above method and then call commit on the unit of work I get a SQLException:
Internal Exception: java.sql.SQLException: ORA-01407: cannot update ("WC"."WP_RELATIONSHIP_INFO_ATT"."RELATIONSHIP_INFO_ID") to NULL
I understand that the reason for this is because the removeFromAttributes method is setting the attribute relationshipInfo member to null, which is causing an UPDATE on the attribute record with null on the required relationshipInfoId.
As suggested in another thread I removed the line that sets the relationshipInfo member to null and I no longer get the exception.
For maintenance reasons I'd prefer to modify as little generated toplink code as necessary, so I'd rather not have to modify the remove method; otherwise I'll have to go through and modify all these types of methods anytime I generate new Java source.
So, how come toplink is generating the code that nulls these member variables if they have to be taken out later?
Is there a way to configure the workbench project so that it does not generate this code, or is it necessary to modify these methods each time I generate the Java source?
Thanks.

In a 1-m mapping the relationship is stored in the database by the foreign key of the 1-1 (m-1) back reference. In a typical 1-m relationship if you just remove the object from the collection it will not update the database unless you also set the 1-1 back to null, (as it will still be referencing the old source and the relationship will be out of synch).
In your case because the 1-m is privately owned and the target will be deleted, it does not need to have the 1-1 updated, so you are correct in removing the code.
In have logged an enhancement request internally with the MW to have this code improved for private-owned 1-m relationships.
In general the source code generation of the TopLink Mapping Workbench (or JDeveloper) is meant as a one-time generation for rapid prototyping, it is not required, and not two-way. Typically the object model will be used to provide application specific behavior, so will be maintained by hand after the initial prototype.

Similar Messages

  • Remove private owned object

    I have counted a problem to remove a private owned object from database. The object is removed from toplink cache successfully but the database row still exists.
    OfferResult object contains multiple OfferDailyResult objects.
    The attribute in OfferResult:
    mktgElementTkey: String (primary key)
    offerDailyResults: ArrayList
    The attributes in OfferDailyResult:
    mktgElementTkey: String (primary key)
    resultDate: Timestamp (primary key)
    resultValue: String
    I am able to remove any OfferDailyResult object from offerDailyResults collection in application server. But the database row is still sitting in Offer_Daily_Result table.
    Is that because I have a Timestamp attribute in the primary key? How can I solve it?
    I'm using weblogic 9.2 and toplink 10.1.3. Since our application was migrated from lower version toplink to toplink 10.1.3, the old way to turn on sql log doesn't work. Could you also tell me how to turn on the sql log?
    Thanks,

    Here is the peseudo-code of removing OfferDailyResult
    object. I have trouble to turn on the Toplink SQL log
    in version 10.1.3. Could you tell me how to turn on
    it?
    public class OfferResult extends MktgElement {
    String mktgElementTkey;
    ArrayList lnk_TelemktgOfferDailyResult;
    public void removeDailyResult(String
    resultDateStr) {
    TelemktgOfferDailyResult dailyResult =
    this.getTelemktgOfferDailyResult(resultDateStr);
    dailyResult.getResultDate().setNanos(0);
    this.lnk_TelemktgOfferDailyResult.remove(this.getTele
    ktgOfferDailyResult(resultDateStr));
    Thanks,This code doesnt show how you are registering the object and then deleting it. Can you include the transaction code as well-the part where you acquire a unit of work, register the object you want to delete as well ?

  • Privately owned object delete problem

    If I delete a privately owned object (B), AND delete its parent (object A, contains B), then the order of SQL deletes is incorrect:
    DELETE FROM A
    DELETE FROM B
    If I just delete object A, then Toplink orders deletes properly:
    DELETE FROM B
    DELETE FROM A
    NOW, the question is, can something be done to fix this because not deleting a privately owned object is not an option (its a long story, but there is a business logic related to this that deletes A when no more B's left, but there is no way to know that up front).
    Thanks
    - rustam -

    There is a previous thread regarding some similar issues:
    Order of delete in unit of work
    The last 2 or 3 posts make me wonder if the issue is similar to the one you are experiencing.
    Does that thread help?

  • Moving Private Owned Objects?

    If I have a object that is privately owned, and I want to move it to another object, is there a way to do this without TopLink wanting to DELETE the object?
    By default, I realize that if a private object is unlinked from its owner, it will be deleted, but if it is reassigned in the same transaction, is there a way for this to simply UPDATE and to not execute the DELETE?
    Nate

    I do not believe this is possible. if you have scenarios where objects need to move between collections then do not mark them as privately-owned. You'll need to enhance you application to delete them in the cases where you need to.
    Doug

  • Entity remove triggering select stmts on private owned relationships

    Hi All,
    When ever we do an entityManager.remove on an entity and commit, the eclipse link is doing a realAllQuery.execute (Select stmt) on each of the privateOwned entities of the given entity(irrespective of whether they are present or not) before actually deleting them .
    This is very much redundant especially if there are large number of entities to delete/cascade delete and each has multiple number of private owned rels - Lots of SELECT SQls , and time taken for these select sqls is very much higher than actual delete stmts. Is there a way to remove the private owned rels without selecting them.
    We are using the ecliselink 2.3.1 version.
    BTW
    This readAllQuery.execute on private owned entitites is triggered during CollectionMapping.recordPrivateOwnedRemovals method of eclipse link during commit.
    Any Input or suggestion greatly appreciated.
    Thanks,
    Sriram

    EclipseLink needs to load an object's private owned relationship to delete the objects, otherwise it does not know which objects to delete.
    The private owned objects can have their own private owned objects and dependent relationships that need to be deleted as well.
    EclipseLink does perform a delete-all optimization for a privately owned OneToMany where the target does not have any dependent relationships (or inheritance/multiple tables/ locking).
    This will occur for a simple OneToMany but most have relationships of their own that prevents the optimization.
    This optimization can also be configured using the @DeleteAll annotation.
    EclipseLink also supports delete cascading on the database, if you have created your foreign key constraint to cascade on delete, or are using EclipseLink to create your schema.
    If you use @CascadeOnDelete, then the related objects should not be loaded.
    If you still think you have more SQL than you think is correct, please include your object model code, and the SQL log for the delete.

  • Need advice regarding the use of Private Owned

    Hello,
    We have the following JPA entity objects:
    @Entity
    public class Claim {
    @PrivateOwned
    @OneToMany(mappedBy = "claim", cascade = CascadeType.ALL)
    private List<ClaimLine> claimLineList;
    @Entity
    public class Bill {
    @OneToMany(mappedBy = "bill", cascade = CascadeType.ALL)
    private List<ClaimLine> claimLineList;
    @Entity
    public class ClaimLine {
    @ManyToOne
    @JoinColumn(name = "CLAI_ID", nullable = false)
    private Claim claim;
    @ManyToOne(cascade = CascadeType.ALL)
    @JoinColumn(name = "BILL_ID")
    private Bill bill;
    Both Claim and Bill have many-to-one references to ClaimLine. The ClaimLine is Privately Owned by the Claim.
    Note that when a Claim is removed, the entire object graph is discarded, i.e. the Bill and ClaimLine objects are also removed. The Bill can be removed without removing the ClaimLine objects.
    The EclipseLink documentation [ http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#How_to_Use_the_.40PrivateOwned_Annotation ] specifies that:
    "+An object should not be the target in more than one relationship if it is the target in a privately owned relationship.+"
    Question: are we running a risk having the ClaimLine object as target in more than one relationship?
    Thanks.
    Best regards,
    -Sjoerd

    Hello,
    When you remove a Claim entity, you will need to clean up all references other entities might have back to the claim item. Because Claim has a privately owned relationship to ClaimLine, all references to the ClaimLines that are to be deleted also need to be cleaned up, or Bill will be inadvertently left referencing a deleted ClaimLine in the cache. If Bill is removed, references to it must be nulled out - specifically in the ClaimLine, but you have to do this in the application or get a constraint violation on the database anyway.
    The risk with privately owned objects is that they are deleted outside the normal constraint checking rules. That is, if ClaimLine is not marked for deletion but its owning Claim is, ClaimLine will not get deleted until the delete for Claim is processed. That means depending on delete ordering, if Bill is marked for delete, it could get processed first, and so deleted deleted before the Claim + ClaimLine, causing a dependency violation. As long as you are setting the ClaimLine->Bill relation to null you won't get a problem. If you are not, and bills are getting deleted first, you can order the dependencies manually so that Claim is always processed for deletes first using addConstraintDependencies on the Claim descriptor described at: http://wiki.eclipse.org/Using_Advanced_Unit_of_Work_API_%28ELUG%29#How_to_Use_the_addConstraintDependencies_Method_of_the_Descriptor
    Best Regards,
    Chris

  • Applications problem: "You cannot update this software since you have not owned the major version of this software."

    Hi all,
    RE: Applications problem: "You cannot update this software since you have not owned the major version of this software."
    Until recently, I have not encountered this problem.  And I am facing this problem for both my iPad and iPhone. 
    I only have 1 iTunes account and the most recent change was that I switched the location from Singapore to UK (I'm currently in the UK).  I also updated my applications a couple of times before since the change in location, so I doubt it's due to the location change.  I've tried signing out of the account in the iTunes accounts on the devices, then signing back in.  I've also tried restarting the devices (and for the iPad, I even updated the iOS). 
    Any idea what else I can do to try to rectify this?
    Thanks and regards,
    Tammy

    Hi there!
    Thanks for replying!
    1.  Yup, my iOS is the latest (6.0.1), and I have 7 apps on my iPhone that apparently have updates.  But it's been 6.0.1 for quite some time and I've also been able to update the apps till just this week.
    2.  I don't have a credit card associated with my account anymore.  Ever since I changed the location, I removed the credit card details.  But I didn't have problems with any of my apps (updating or downloading new ones) until this week.  Also, all the apps I've downloaded since I came to the UK are free apps. 
    I still don't know what's wrong. 

  • Error message: cannot remove older versions of apple software update

    I recently got a 30 gb ipod, and i cant install itunes 7. I originally tried installing it at first, and it said cannot remove older applications of Apple Software Update. So i installed itunes 4 to put music on my ipod. Then i tried again to install itunes 7 and i keep getting the same error message. Anyone else having this problem? Can anyone give me some suggestions please?

    I would first try and remove both iTunes and Quicktime prior to doing the install of iTunes. The following link will show you how to remove both programs. Make sure you do Step 16 as it is usually Quicktime that causes problems with the upgrade.
    http://docs.info.apple.com/article.html?artnum=93698
    If it will not let you remove the programs, you can try using the Windows Installer Cleanup Utility. The download is about 1/4 of the way down the page. Good luck.
    http://support.microsoft.com/default.aspx?scid=kb;en-us;290301

  • My iphoto library won't resume update. When I go to app storYou cannot update this software since you have not owned the major version of this software.

    I tried to update my photo library a week ago, but I stopped it. Now that I wanted to resume updating, it says in the app store "You cannot update this software since you have not owned the major version of this software." WHAT DO I DO??

    I already fixed mine, i used my other apple id to resume its update

  • I have QuickTime Player 7.6.8, I cannot update or remove it b/c I am missing QuickTime.msi file. It is gone and I need it back. Please help.

    I have QuickTime Player 7.6.8, I cannot update or remove it b/c I am missing QuickTime.msi file. It is gone and I need it back. Please help.

    Unfortunately, this sort of trouble has gotten more complicated to deal with ever since Microsoft pulled the Windows Installer CleanUp utility from their Download Center on June 25. First we have to find a copy of the utility.
    Let's try Googling. (Best not to use Bing, I think.) Look for a working download site for at least version 3.0 of the Windows Installer CleanUp utility. After downloading the utility installer file (msicuu2.exe), scan the file for malware, just in case. (I use the free version of Malwarebytes AntiMalware to do single-file scans for that.)
    If the file is clean, to install the utility, doubleclick the msicuu2.exe file you've downloaded.
    Now run the utility ("Start > All Programs > Windows Install Clean Up"). In the list of programs that appears in CleanUp, select any QuickTime entries and click "Remove".
    Quit out of CleanUp, restart the PC and try installing iTunes again. Does the install go through properly now?
    (If you do find a clean download site for the correct version of CleanUp, please don't tell me where it is. Without wishing to sound paranoid (although I grant it does sound paranoid), there is a non-zero chance that posting links to download locations for the utility here at Discussions leads to that download location being shut down.)

  • Java.sql.SQLException:ORA-01407: cannot update ("WAVESET", "TASK", "XML")

    Hi,
    We are currently facing the above mentioned error while trying to install Sun IdM 7.1 in WebSphere 6.0. The same ear works fine in all my other environments (all are WebSphere 5). This is what we did
    1. Took a copy of the ear thats works.
    2. Extract.
    3. Modified the serverrepository.xml by using the lh command. Use the newly generated xml file in the extracted folder (WEB-INF), Pack it to a new EAR
    4. Configure the datasource that will be used to communicate with the Index repository.
    5. Deploy.
    Deployment completes successfully. However, when we try to run a task, or import file using IdM admin console, we get this error 'java.sql.SQLException:ORA-01407: cannot update ("WAVESET", "TASK", "XML") to NULL'. we even checked the user permissions on this db schema. they all look good.
    We also checked if we are using the right iiop port number in lh command.
    We arent sure what could be the issue. I am not able to simulate this issue in other environment, as they all turn out to be successful.
    any pointers?
    thanks.

    I still think it's a jdbc error.what is your DB platform?
    is you ServerRepository.xml configured with a jndi data source (and that's why you use iiop)? If so then try to create a new connection through a direct DB URL like:
    lh setRepo -tDBTYPE -uURL -Uusername -Ppassword -n -oServerRepository.xml
    and then try to re-run your update command. if it fails again then please post the complete error message.. hope this helps

  • HT2404 When I try to download free updates for apps, I've suddenly started getting an error message saying: You cannot update this software since you have not owned the major version of this software." But I do own the apps. And I haven't changed my ID

    When I try to download free updates for apps, I've suddenly started getting an error message saying "You cannot update this software since you have not owned the major version of this software".
    But I HAVE owned the software, for ages. (And, in any case, the apps in question are all free.)
    And I don't have multiple Apple IDs.
    What can I do?
    Any advice much appreciated

    This can occur if you bought the machine used and iLife was reinstalled with another AppleID.
    This also can occur if the "free apps" you downloaded have paid upgraded versions and/or are now payware and you can't get updates.
    All software from MAS is copy protected, it might be free as in "no charge" but it's not free in the sense you can share it with others.

  • A client has sent me an indesign file I cannot open. She says she has updated to Indesign CC 2014. I am a CC member and fully updated my own software but cannot open the file she has sent me, not even if she saves as an IDML, how do I resolve the problem?

    A client has sent me an indesign file I cannot open. She says she has updated to Indesign CC 2014. I am a CC member and fully updated my own software but cannot open the file she has sent me, not even if she saves as an IDML, how do I resolve the problem?

    There are a few things to try.
    First, if this file came to you vial email attachment, it could have been corrupted. Ask her to zip the file and send it again. That sometimes helps.
    I suppose there's a chance that the file is already zipped, so see if that's the case and unzip it if so.
    If the file name doesn't end with .indd, add it and see if that helps.
    If you are double-clicking, try File>Open from within InDesign.
    Last (and I know this sounds like a joke, but I've seen it many times), sometimes people attach a Mac Alias or Windows Shortcut instead of the actual file. What is the file size? If it's really small, that might be the reason.
    Also, no offense intended if some of this sounds like stuff you have already tried. I don't know what you know, so I'm just spit-balling.

  • ORA-28336: cannot encrypt SYS owned objects

    Hi ,I am getting the following error during impdp.
    Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
    ORA-31693: Table data object "IDCFAPP"."ROBJECTOFSERVICE" failed to load/unload and is being skipped due to error:
    ORA-28336: cannot encrypt SYS owned objects
    any suggestions?

    ORA-31693: Table data object string failed to load/unload and is being skipped due to error: string
    Cause: Table failed to load or unload due to some error.
    Action: Check load/unload error, correct problem and retry command.
    This error is most likely because the SQL statements were run from the SYS user account
    ~ Madrid

  • "Cannot update iPhone Apps since I have not owned the major version" proble

    I have three iTunes accounts which I use to download music and apps from iTunes (USA, UK and Italy).
    Since now when I had to update software I just switched between accounts and downloaded the apps. This morning iTunes told me that I "Cannot update this software since you have not owned the major version of this software", which is not true.
    This is blocking all my updates, not just some of them. What could it be and how can I sort it out?

    I flagged this with Apple support after writing a blog post on the subject at http://is.gd/9wdB1
    Apple's initial response was to helpfully inform me that things had always been this way, whereas very recently you only saw updates for the signed-in account. The issue's now been escalated, but I've not heard anything back.
    The only 'solution' at present I've found is to click every Get Update button and dismiss the 'You can not update this software since you have not owned the major version of this software' dialog when it appears, sign into your other account immediately and then download everything. Frankly, this is pathetic and a massive UX disaster from a company that should know better.

Maybe you are looking for

  • Mac OS 10.4+ Bluetooth Adaptors

    Hello. I just wondered if anyone could tell me how fussy Mac OS 10.4 is with generic USB bluetooth adaptors. I just don't fancy paying £20+ for the D Link Bluetooth Mac supported version if I can get one from eBay for under a tenner. Many thanks. Pow

  • Dynamic Image ONLY appearing in Safari

    I am trying to create a page that uses a URL variable to get a value from a database and use it to display an image on a page. When I preview the page in Safari, the image appears. When I preview the page in Firefox or IE, the alt text appears instea

  • Is it a bug in Mavericks Calendar?

    Hi, adding new events in my Calendar app i just realized that whenever i try and set a custom alarm to notify the event more than 2 days before it, it doesnt keep it. In particular i want to set an alarm 1 week before the event, and it seems there is

  • Unloading Point in Production Order

    Hi, I need some help. I want to update field "Unloading Point" in transaction CO01 (Component details). But I want to set it for every component in BOM so the user doesn't have to enter the unloading point manually in every production order. I update

  • Can't upgrade to 10.6 from 10.4 ??

    Hi, I have been trying to upgrade from 10.4 Tiger to Snow Leopard on both of my machines (Macbook Black/ MacPro Quad, both circa 2007) and cannot for the life of me. The disk asks 'click to start the installation process' and then after requesting th