(Kodo 4.1); DELETE issued even with @ForeignKey cascade delete?

I'm wondering if anyone has seen this.
I'm using Kodo 4.1, and MySQL, and I basically have the following situation (default generated IDs omitted):
Code:
@Entity
public class A {
  @OneToMany(mappedBy="a", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
  private Set<BB> bMany = new HashSet<BB>();
@Entity
public class BB {
@ManyToOne(cascade={CascadeType.PERSIST, CascadeType.REFRESH })
@JoinColumn(name = "A_ID")
@ForeignKey(deleteAction=ForeignKeyAction.CASCADE)
private A a;
Schema:
CREATE TABLE BB(
  A_ID BIGINT NOT NULL,
  CONSTRAINT FOREIGN KEY (A_ID) REFERENCES A(ID) ON DELETE CASCADE
) ENGINE=InnoDB;OK. I create an A with a couple of BBs in it, and persist it. Everything's fine. Now I call entityManager.remove() on the A instance I persisted, and I can see it issuing DELETE commands for BB after the DELETE for A, which produces an OptimisticLockException. I'd have hoped that the above @ForeignKey would have told Kodo not to issue such commands, knowing that the DB would do it.
Any insight? Have I used @ForeignKey correctly (examples seem sparse in the documentation)? Is there a workaround, other than removing the cascade delete and doing deletions manually from code?
Thanks,
-- Bryan Loofbourrow

1. Kodo needs to know the constraints set on mapped columns.
Set the following properties in your configuration
kodo.jdbc.SchemaFactory:native(ForeignKeys=true)
2. Are you explictly setting kodo.jdbc.UpdateManager property?

Similar Messages

  • Apple TV mirroring issues even with Mac mini,airport extreme bought at the end of last year,and an iPad 2

    Apple TV mirroring issues even with Mac mini,airport extreme bought at the end of last year,and an iPad 2

    I have the same issue with ATV3 and iPhone 4S. Everything works properly, no buffering issues when watching netflix, vimeo, youtube BUT when I try mirroring even a small 15sec iPhone movie it stutters and buffers and results to a choppy playback..same with larger mp4 files such as 1-1.5GB, buffers forever and never plays, I just re-encoded the same movie to 700MB and plays perfectly..
    Why Apple, why?..so close..I can accept the bigger movie files issue, but not being able to playback properly an iPhone movie is funny..I recorded a movie with lower bitrate through Filmic Pro (Economy mode, up to 16Mbps)
    and plays properly.
    Is there an upcoming software update going to solve the problem or is it hardware related and therefore not fixable.
    Please don't reply with a network related answer, by 2012 we know how to set up our networks and everything else runs flawlessly.
    I'll apreciate a fast answer, we love Apple, but if it can't play an iphone movie (or a high quality movie from iTunes) it's just not up to my standards.
    Thanks again.
    JP

  • Delete an evenment with guests without send us the update

    Hy
    First, I'm sorry for my english
    I would to know if is it possible to delete an evenment with guests without send us the update?
    thanks

    up?

  • IPhone 5s WiFi Issue even with iOS 8.1.1

    I had Problem before with WiFi. Check my Previous topic: iPhone WiFi Speed Issue iOS 8.1
    At certain times of the day my iPhone 5s still have this problem Now Running iOS 8.1.1
    Apple Please don't do this with us! i tried all the ways But there is no result (Changing Router, Reset etc.)
    Should i wait for iOS 8.2 !!!?????

    the issue to the use of Apple’s Wireless Direct Link (AWDL) that is used for AirDrop, AirPlay, and Gaming connections. I’ll go out on a limb and say the WiFi issues are because of Apple’s choice of using Bonjour over AWDL and that, given the constraints of the WiFi hardware, this will be difficult to get right in the first few updates ie 8.1 and 8.1.1 but given time it should be sorted out

  • Is there another bug fix coming soon. IpadAir, iPod and iPhone are still having many, many issues even with the last update. IOS8 has been a disaste! 

    Many features are still having issues, including basic iPad, iPod and iPhone functions that used to be rock solid. When can we expect the next SW releases?

    The Real Big Mac wrote:
    Many features are still having issues, including basic iPad, iPod and iPhone functions that used to be rock solid. When can we expect the next SW releases?
    What troubleshooting steps have you taken?

  • How do I resync a song manually deleted on iPhone with 'swipe to delete'?

    I accidently deleted a song while browsing music on my iPhone (with the swipe to delete function) and now I am not able to resync the song back onto the phone even though it's still happily there in iTunes on my iMac.
    I've tried explicitly adding it to a playlist that enforces a sync to the iPhone and I can actually see iTunes telling me that it's syncing it to the phone, however it still doesn't show up when on the phone - so I guess the iPhone is somehow remembered the delete operation and is hiding it from me?
    Does anyone know how I might get this song showing back up on my iPhone???
    Any help greatly appreciated!
    Thanks,
    Andy

    It depends on which country that you are in as to whether you can re-download it - it's not currently possible in all countries (what you can re-download, and where, is listed on this page). If you can re-download music then it should appear in the Purchased section under Quick Links on the right-hand side of the iTunes store home page on your computer's iTunes, and the Purchased tab at the bottom of the iTunes app on the iPad : re-downloading

  • Master/Details tables with CASCADE delete giving "table mutating" error

    Hi,
    I have two tables in a master/details configuration (table 1 is "master", table 2 is "details").
    The details has a FK contraint relation to the master with a CASCADE delete (so when the master is deleted, all associated details are deleted).
    The master table has a column "last_updated_datetime" which is updated by a master table update trigger whenever most (excluding the last_updated_datetime column) columns are updated.
    The details table has an update trigger which also updates the master table's last_updated_datetime column (whenever a detail row is changed).
    The details table also has a delete trigger which also updated the master table's last_updated_datetime column (whenever a detail row is deleted).
    The problem I have is: When the master record is deleted, which cascade deletes the details record(s), the delete trigger on the details table throws a "table is mutating" error.
    I understand that the "mutating" error is "correct" because the master record is being deleted.
    But is there some way I can get around this problem (for example, having the details table delete trigger not update the master table last_updated_datetime) when it's this cascade delete?
    Thanks for your help!

    create table master (
      id number primary key,
      changed date not null
    create table detail (
      id number primary key,
      master_id references master (id) on delete cascade
    create or replace package pkg is
      master_deleted boolean := false;
    end;
    create or replace trigger bds_master
      before delete on master
    begin
      pkg.master_deleted := true;
    end;
    create or replace trigger ads_master
      after delete on master
    begin
      pkg.master_deleted := false;
    end;
    create or replace trigger adr_detail
      after delete on detail
      for each row
    begin
    if not pkg.master_deleted then
        update master
           set changed = sysdate
         where id = :old.master_id;
      end if;
    end;
    insert into master values (1, sysdate - 10);
    insert into detail values (11, 1);
    insert into detail values (12, 1);
    insert into master values (2, sysdate - 10);
    insert into detail values (21, 2);
    insert into detail values (22, 2);
    insert into master values (3, sysdate - 10);
    insert into detail values (31, 3);
    insert into detail values (32, 3);
    commit;
    select * from master order by id;
            ID CHANGED                                                             
             1 01.09.08                                                            
             2 01.09.08                                                            
             3 01.09.08                                                            
    select * from detail order by id;
            ID  MASTER_ID                                                          
            11          1                                                          
            12          1                                                          
            21          2                                                          
            22          2                                                          
            31          3                                                          
            32          3                                                          
    delete detail where id = 21;
    select * from master order by id;
            ID CHANGED                                                             
             1 01.09.08                                                            
             2 11.09.08
             3 01.09.08                                                            
    select * from detail order by id;
            ID  MASTER_ID                                                          
            11          1                                                          
            12          1                                                          
            22          2                                                          
            31          3                                                          
            32          3                                                          
    delete master where id in (1, 2);
    select * from master order by id;
            ID CHANGED                                                             
             3 01.09.08                                                            
    select * from detail order by id;
            ID  MASTER_ID                                                          
            31          3                                                          
            32          3                                                           Regards,
    Zlatko
    Edited by: Zlatko Sirotic on Sep 11, 2008 11:15 PM
    This is disaster - ten attempts to format code!

  • Weblogic 9.1, EJB 2.0, Oracle 9i: Cascade delete Error

    Hi All,
    I am facing an error with the cascade-delete facility in ejb2.0 with weblogic 9.1
    Assume that I have the following relation:
    <ejb-relation>
    <ejb-relation-name>TeacherEJB-StudentEJB</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>teacher-has-student
    </ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>TeacherEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>teacher</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>student-has-teacher
    </ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>StudentEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>student</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type><cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    Now when I have to delete one record from the DBSTUDENT table, what i do is the following:
    StudentHomeLocal.remove(studentModel.getStudentId());
    The above statement throws an SQLException staying it can't update TeacherID in DBSTUDENT (PK of DBTEACHER, FK in DBSTUDENT) with NULL.
    The same code is working perfectly well in Weblogic 8.
    I even tried deleting the local directly by the following statement:
    StudentLocal.remove();
    But this too doesn't work.
    I also tried by removing the <cascade-delete/> attribute from the ejb-jar.xml file and updating the 'on-delete cascade' option in the database, but this too did not work.
    There is another option of <db-cascade-delete> in weblogic-cmp-rdbms-jar.xml that I tried but this too did not work.
    In short, I have tried the following cases but to no avail:
    1. Mention cascade delete in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar and in the database.
    2. Mention nothing in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar but 'on cascade delete' mentioned in the database.
    3. Mention cascade delete in ejb-jar.xml and db-cascade-delete mentioned in weblogic-cmp-rdbms-jar.xml.jar and 'on cascade delete' in the database.
    4. Remove all cascade delete from the ejb-jar.xml,the weblogic-cmp-rdbms-jar.xml and from the database.
    Neither of the above work.
    Kindly help ASAP.
    Thanks in advance,
    Sachidanand.

    Hi All,
    I am facing an error with the cascade-delete facility in ejb2.0 with weblogic 9.1
    Assume that I have the following relation:
    <ejb-relation>
    <ejb-relation-name>TeacherEJB-StudentEJB</ejb-relation-name>
    <ejb-relationship-role>
    <ejb-relationship-role-name>teacher-has-student
    </ejb-relationship-role-name>
    <multiplicity>One</multiplicity>
    <relationship-role-source>
    <ejb-name>TeacherEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>teacher</cmr-field-name>
    </cmr-field>
    </ejb-relationship-role>
    <ejb-relationship-role>
    <ejb-relationship-role-name>student-has-teacher
    </ejb-relationship-role-name>
    <multiplicity>Many</multiplicity>
    <cascade-delete/>
    <relationship-role-source>
    <ejb-name>StudentEJB</ejb-name>
    </relationship-role-source>
    <cmr-field>
    <cmr-field-name>student</cmr-field-name>
    <cmr-field-type>java.util.Collection</cmr-field-type><cmr-field>
    </ejb-relationship-role>
    </ejb-relation>
    Now when I have to delete one record from the DBSTUDENT table, what i do is the following:
    StudentHomeLocal.remove(studentModel.getStudentId());
    The above statement throws an SQLException staying it can't update TeacherID in DBSTUDENT (PK of DBTEACHER, FK in DBSTUDENT) with NULL.
    The same code is working perfectly well in Weblogic 8.
    I even tried deleting the local directly by the following statement:
    StudentLocal.remove();
    But this too doesn't work.
    I also tried by removing the <cascade-delete/> attribute from the ejb-jar.xml file and updating the 'on-delete cascade' option in the database, but this too did not work.
    There is another option of <db-cascade-delete> in weblogic-cmp-rdbms-jar.xml that I tried but this too did not work.
    In short, I have tried the following cases but to no avail:
    1. Mention cascade delete in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar and in the database.
    2. Mention nothing in ejb-jar.xml and nothing mentioned in weblogic-cmp-rdbms-jar.xml.jar but 'on cascade delete' mentioned in the database.
    3. Mention cascade delete in ejb-jar.xml and db-cascade-delete mentioned in weblogic-cmp-rdbms-jar.xml.jar and 'on cascade delete' in the database.
    4. Remove all cascade delete from the ejb-jar.xml,the weblogic-cmp-rdbms-jar.xml and from the database.
    Neither of the above work.
    Kindly help ASAP.
    Thanks in advance,
    Sachidanand.

  • Question on Cascade Deletes

    All,
    Facts :
    1) I have 2 tables 150mil rows (table A) and second 125 mils rows (table B).
    2) Table A <-> B is having FK 1:1 relationship and delete on table A is cascade delete on B
    Issue : We are missing 25 mil rows in table B, and trying to delete Table A records with a PK in the where clause, I discovered that the cascade delete tries to Delete records in table B there are no records related to table A and it does a full table scan.
    Question : How to delete the 25 mil rows effectively.
    1) create index on table B same as PK of A and delete records from table.
    2) Drop the FK constraint on table B and delete the records from table A and re-create the constraint.
    Which one would be faster ?
    Thanks,
    SS

    Pransuj,
    You too! do not read the posts.
    Have you heard about the concept of Partition
    Tables.
    Heard about Partition, Used it Extensively. Partitioning is not available at my clients place.
    If I were you and have tables with that many millions
    of rows, I would go for partition tables. If you have
    partitioned tables you would not have run into these
    kinds of problems
    Not good enough Statement or reason to do Partitioning.
    SS

  • Virtual private database and cascade delete

    We can't secure rows deleted by cascade delete by vpd.
    User "A" have right to delete row "1" but don't have right to delete row "2".
    If user "A" delete row "1", database will delete also row "2" by cascade delete.
    Why it is possible to delete row "2"?

    Either of the two options (a policy that queries the base table or propagating the security columns to the child tables) should work.
    My preference from a data model standpoint would be to have a policy that queries the base table so that the security information can be maintained in exactly one place. But if your application is frequently querying the child tables without reference to the parent table, joining to the parent table, particularly if data volumes are such that an IN would be less than ideal, there may be performance issues to this approach.
    Copying the columns creates a potential data integrity problem-- if you change the security on a base table row, you may forget to change the security on all the child records. But that issue may not be significant if the security is essentially static once the rows are created. And it's definitely easier to tune.
    You may also want to create views that join the parent and child tables and grant users access to these views rather than to the child tables directly, which would allow you to have a single policy on the base table and get most of the benefits of the first option with less performance problems if data volumes make an IN less than ideal.
    Justin

  • Exchange SBS2003: Email that is deleted in Outlook 2010 is not deleted on iPhone 4, or marked read after upgrading to 6.0.1.  Win 7 64bit.  2 Other users in our office with iPhone 4 and iPhone 4s aren't having this issue.  They didn't upgrade to 6.0.1.

    Exchange SBS2003: Email that is deleted in Outlook 2010 is not deleted on iPhone 4, or marked read after upgrading to 6.0.1.  Win 7 64bit.  2 other users in our office with iPhone 4 and iPhone 4s aren't having this issue.  They didn't upgrade to 6.0.1 though.  Mail that is deleted or read on the iPhone 4 is deleted or marked read in Outlook 2010.  So it's a one-way problem.

    Exchange SBS2003: Email that is deleted in Outlook 2010 is not deleted on iPhone 4, or marked read after upgrading to 6.0.1.  Win 7 64bit.  2 other users in our office with iPhone 4 and iPhone 4s aren't having this issue.  They didn't upgrade to 6.0.1 though.  Mail that is deleted or read on the iPhone 4 is deleted or marked read in Outlook 2010.  So it's a one-way problem.

  • The genius bar sold me a LaCie 500 GB EHD today but I can't get it to work properly.  Can I schedule another genius bar appt. to help me with this issue even though the EHD is not an Apple product?

    The genius bar sold me a LaCie 500 GB EHD today but I can't get it to work properly.  Can I schedule another genius bar appt. to help me with this issue even though the EHD is not an Apple product?

    Yes, if you purchased it in an Apple store, they should be able to assist you.  Bring your MBP with you as well as the Drive.
    Ciao.

  • Every time i want to delete something  the iMac wants my password.. before it was not like this.. even with pictures.. how can i solve the problem so can delete my pics without my password all the time

    With everything i want to delete the iMac wants my password, before it was not like that, i'm getting crazy of it.. Even with pics he's asking for my password..
    How can i solve the problem and delete stuff without filling in my password every time..
    Already thnx for your support and help..

    Normally, that's caused because of a permissions problem. Have a look at this site > http://www.thexlab.com/faqs/trash.html#Anchor-Files-46919

  • Issue with emails being deleted from my Yahoo mail folders

    Hi, I am experiencing an issue where emails are being deleted from my Yahoo mail folders when the weekly Sunday night purge of the Yahoo Trash folder is carried out by Yahoo. These are mails that have been moved from my inbox via the iphone mail app.
    I have a similar problem with Outlook 2010 on my laptop but not with Outlook 2003 on my desktop.
    When I move the emails from my inbox I have noticed that using Outlook 2003, the moved email is left in my inbox in "strikethrough" mode whereas on Outlook 2010 it is deleted from my inbox. I subsequently purge the marked email from my inbox in 2003.
    I am able to see and access the emails in the folder I have moved them to until after midnight on Sunday when they dissappear. The emails moved via 2003 are ok and not lost.
    Funnily enough when using an earlier version of the iphone mail app I remember that I could see emails in "strikethrough" mode in Outlook 2003 when they had been moved via the iPhone mail app but you don't see that now.
    It feels like some sort of pointer issue to me ...... any ideas on how to stop this happening?.

    This is now fixed !!!! I am not sure how though :-((
    I reported the problem to Yahoo and in the process of them investigating the issue my sub-folders suddenly became invisible via my IMAP connection and then also were invisible on-line following a log out and a log in. After my initial panic, I contacted Yahoo who were able to restore my complete account. Since then, the problem has gone away.
    I have been testing this for two weeks and all is working perfectly from whatever device I use to connect to my mail (IMAP or via my browser).
    Phew!

  • Why did iTunes delete 2000 photos during Sync, even with 1 GB free space

    I am having real headaches with Sync function in iPhone/iTunes. The 2 biggest problems concern Contacts and Photos.
    Photos: I used to have 4465 photos on my iPhone, using 1.47 GB at a time when my iPhone still had 0.67 GB free capacity out of its 29.3 GB total. About a week ago, while syncing with iTunes, I saw the error message on my PC stating that there is not enough space on my iPhone to copy all photos. At the end of that sync, I was left with only 2072 photos using 0.78 GB, while the free capacity on my iPhone increased to 1.6 GB. I have synced at least 10 times since then to try and recover my photos, I have deleted the 2.4 GB photo cache, but exactly the same error message and issues happen. Please help get my photos back into my iPhone!!?
    Contacts: my iPhone is the principal device on which I put new contacts or update existing ones. After syncing, sometimes I see that the new information entered into my iPhone is no longer there. And so I lose contact with people, since I have no other records! That’s really frustrating.
    I have tried upgrading my iPhone software from current v4.02 to the latest v4.1, but for the 5 times that I have tried my WiFi has timed out, and so still not upgrade, as Murphy Law would have it!

    I guess I should have included a little more info:
    1. I only have 1 appleID
    2. I only have 1 apple device (the one iphone, nothing else)
    3. I only sync on one computer (VERY annoying you cant use more than 1!!)
    4. I never have any other problems during syncing and don't change any settings
    5. I downloaded the app again so it is back.
    I am not asking how to get the app back, I just want to know WHY itunes deleted this app. This is the second or 3rd time it has happened and it is really annoying.
    I also would like to get my files back. So again, I'd like to know why itunes deleted the app and if it deleted my files as well.
    The most important part of this is to find out WHY this happened so that it wont happen again. It seems to be a pretty simple operation: Plug the iphone in, itunes opens and does a sync. It almost always works perfectly, I never change any settings. Yet every once in a while it deletes a newly installed app so obviously something is wrong. If I can find out what I did wrong, then I can avoid it in the future.
    Thanks!
    Scott

Maybe you are looking for