Hi Andrus, I've submitted a bug with my cayenne xml files and a simple code snippet to reproduce the issue.
https://issues.apache.org/jira/browse/CAY-1725 Please let me know anything else you need. Thank you! Aaron On July 12, 2012 04:42:35 PM Andrus Adamchik wrote: > This has to be something mapping related. Unless your mapping is > confidential, could you possibly open a bug report at > https://issues.apache.org/jira/browse/CAY and attach the Map XML file, and > maybe a code snippet? > > Thanks, > Andrus > > On Jul 12, 2012, at 4:30 PM, Aaron Andersen wrote: > > Andrus, > > > > No problem, thank you for your reply! > > > > I am able to produce this bug without calling add at all. Simply calling > > remove and then committing before calling anything else causes this > > behaviour. > > > > That is good to know about 3.0.2, but unfortunately it does not solve my > > problem. I tried the 3.1 beta build hoping it would fix the problem when I > > first discovered it, but it did not. This morning, after I read your > > email, I tried 3.0.2 and the problem still exists. > > > > Any help would be greatly appreciated. > > > > Thank you! > > Aaron > > > > On July 12, 2012 02:07:43 PM Andrus Adamchik wrote: > >> Hi Aaron, > >> > >> sorry for the late reply.. > >> > >> Are add... and remove... called in sequence after each other or is there > >> a > >> commit between them? > >> > >> Also going through release notes for 3.0.2, there were a few fixes > >> related > >> to flattened relationships. While I can't say for sure that your issue > >> was > >> addressed there, maybe it is worth upgrading before we dig any deeper? > >> > >> Cheers, > >> Andrus > >> > >> On Jul 5, 2012, at 4:23 AM, Aaron Andersen wrote: > >>> Hello, > >>> > >>> I am using Cayenne version 3.0.1 and having an issue. > >>> > >>> In CayenneModeler I have created an "Approver" DbEntity and a > >>> "Department" > >>> DbEntity (as well as the corresponding ObjEntity classes). I have also > >>> created an "Authorization" DbEntity to act as a join table for the > >>> Approver and Department tables. Every Approver object has a list of > >>> Department objects associated with it, and vice versa so in > >>> CayenneModeler I have added a "departmentArray" relationship to the > >>> Approver object which has "to many, list" semantics. > >>> > >>> When I use the Approver method "void addToDepartmentArray (Department)" > >>> everything works fine, but when I use the Approver method "void > >>> removeFromDepartmentArray (Department)" (which simple calls > >>> removeToManyTarget) a NullPointerException is thrown. A backtrace and > >>> quick > >>> debug tells me the null pointer exception originates from: > >>> > >>> org.apache.cayenne.access.DataDomainFlattenedBucket.addFlattenedDelete(D > >>> at > >>> aDomainFlattenedBucket.java:82) > >>> > >>> The code on lines 81 and 82 of this file are as follows: > >>> > >>> [81] List flattenedSnapshots = > >>> flattenedDeleteInfo.buildJoinSnapshotsForDelete(node); > >>> [82] if (!flattenedSnapshots.isEmpty()) { > >>> > >>> Inspecting flattenedSnapshots on line 82 shows that flattenedSnapshots > >>> is > >>> null hence accessing the isEmpty method is causing the null pointer > >>> exception. > >>> > >>> A couple of obvious points I can list off are: > >>> - both the approver and the department are not null > >>> - the department does belong to the approvers list of departments > >>> - both objects are in the same context > >>> > >>> I'm not sure what I am doing incorrect to cause this null pointer > >>> exception > >>> but I would really appreciate any help. > >>> > >>> Thank you for your time! > >>> Aaron
