Return-Path: Delivered-To: apmail-incubator-cayenne-user-archive@locus.apache.org Received: (qmail 34367 invoked from network); 5 Jun 2006 13:01:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jun 2006 13:01:17 -0000 Received: (qmail 6696 invoked by uid 500); 5 Jun 2006 13:01:17 -0000 Delivered-To: apmail-incubator-cayenne-user-archive@incubator.apache.org Received: (qmail 6440 invoked by uid 500); 5 Jun 2006 13:01:16 -0000 Mailing-List: contact cayenne-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cayenne-user@incubator.apache.org Delivered-To: mailing list cayenne-user@incubator.apache.org Received: (qmail 6431 invoked by uid 99); 5 Jun 2006 13:01:16 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2006 06:01:16 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of hefest@gmail.com designates 64.233.182.185 as permitted sender) Received: from [64.233.182.185] (HELO nf-out-0910.google.com) (64.233.182.185) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jun 2006 06:01:14 -0700 Received: by nf-out-0910.google.com with SMTP id p77so1492880nfc for ; Mon, 05 Jun 2006 06:00:53 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=RS0LIi7w5nl4EDhCbGzvtvqQN4Ge/apgg7o74x2z+2vxQrAmPG7vic75SnHE5YEoOpSNkZgi9uq7pXpRRR4Nu+lszeH8U+G7VRTCNNV57S7IgJ3/Xt7WaQW4v3lRbKWtUL9ufge8T7sL/XfeTEEAGzKhGqBdYPVTUX7GcIIylEw= Received: by 10.49.2.11 with SMTP id e11mr3184497nfi; Mon, 05 Jun 2006 06:00:53 -0700 (PDT) Received: by 10.48.206.7 with HTTP; Mon, 5 Jun 2006 06:00:52 -0700 (PDT) Message-ID: Date: Mon, 5 Jun 2006 15:00:52 +0200 From: "Tomi NA" To: cayenne-user@incubator.apache.org Subject: Re: very, very serious problem - null values where objects should be In-Reply-To: <46FCBD16-A5C5-48C4-A69A-F7B5B8A5E062@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <46FCBD16-A5C5-48C4-A69A-F7B5B8A5E062@gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On 6/5/06, Marcin Skladaniec wrote: > Hi. > Does the reverse relationship work ? > > Try isolating the bug from GUI and other parts of your code and see > if it persists. Though I understand the need for this, it is much easier said than done. I took your advice and set up some code before the GUI had a chance to do anything and everything worked as expected. We can say that basic functionality is in place and works. However, the complex event sequences, usage of a databinding framework coupled with classes generated with a modifed superclass template create a fairly hard to follow interaction. The breakpoint in the setToObjectGroup() method never catches anything, for instance. It is the usage environment that somehow nullifies parts of the object graph... I'll have another good look at it and see if I'm any wiser for it, but this is a scary problem to run into with such a complex (architecturally speaking) app. > Regards > Marcin > > On 05/06/2006, at 7:33 PM, Tomi NA wrote: > > > I see very disturbing behaviour and while I'm not certain cayenne is > > to blame, maybe someone could shed a little light on the subject. > > First of all, I'm using 1.2RC1 - inherited the .xml files from > > previous versions of 1.2. > > > > I experience what appears to be random null objects in the object > > graph. At the moment, I'm debugging the app and am looking at the > > following one-to-many relationship... > > I have an object myObject whose getToObjectCategory() method should > > give me the category of myObject - the method returns null. > > In the database (pgsql 8.1.3), I can see that the category is intact - > > no problem there. Looking at the myObject state, I can see that it's > > persistenceState is set to 3 - so this is not a modification that > > happened in memory - I believe the state would be 4 in that case. > > What's more, I have a drop-down menu in the GUI where the seemingly > > missing object category is present. > > > > A bit of information about my envinomnent... > > I'm the only user connected to the database, my app is the only app > > accessing the data and no (intentional) data modification takes place. > > I generate regular subclasses and custom superclasses (listed bellow) > > - the only customization is the addition of change monitoring code (so > > that I can bind the beans to my GUI via jgoodies binding). > > > > This is a major problem - I don't know where to start with it... :-( > > > > t.n.a. > > > > > > > > > > > > > > > > > > > > > > #if( ${classGen.isUsingPackage()} ) > > package ${classGen.packageName}; > > > > #end > > #if( ${classGen.isContainingDeclaredListProperties()} ) > > import java.util.List; > > > > #end > > /** Class ${classGen.superPrefix}${classGen.className} was > > generated by Cayenne. > > * It is probably a good idea to avoid changing this class manually, > > * since it may be overwritten next time code is regenerated. > > * If you need to make any customizations, please use subclass. > > */ > > public class ${classGen.superPrefix}${classGen.className} extends > > $classGen.superClassName { > > > > > > // CUSTOM CODE > > private java.beans.PropertyChangeSupport propertyChangeSupport = > > new java.beans.PropertyChangeSupport(this); > > > > ## Create property names > > #foreach( $attr in ${classGen.Entity.DeclaredAttributes} ) > > #set( $classGen.Prop = $attr.Name )## let controller know about > > current property > > public static final String ${classGen.propAsConstantName}_PROPERTY > > = "${attr.Name}"; > > #end > > #foreach( $rel in ${classGen.Entity.DeclaredRelationships} ) > > #set( $classGen.Prop = $rel.Name )## let controller know about > > current property > > public static final String ${classGen.propAsConstantName}_PROPERTY > > = "${rel.Name}"; > > #end > > > > #if( $classGen.Entity.DbEntity ) > > #foreach( $idAttr in ${classGen.Entity.DbEntity.PrimaryKey} ) > > #set( $classGen.Prop = $idAttr.Name )## let controller know about > > current property > > public static final String > > ${classGen.propAsConstantName}_PK_COLUMN = "${idAttr.Name}"; > > #end > > #end > > > > > > // CUSTOM CODE > > public void addPropertyChangeListener > > (java.beans.PropertyChangeListener l) { > > propertyChangeSupport.addPropertyChangeListener(l); > > } > > > > public void > > removePropertyChangeListener(java.beans.PropertyChangeListener l) { > > propertyChangeSupport.removePropertyChangeListener(l); > > } > > > > ## Create attribute set/get methods > > #foreach( $attr in ${classGen.Entity.DeclaredAttributes} ) > > #set( $classGen.Prop = $attr.Name )## let controller know about > > current property > > #if ("true" != "${classGen.getEntity().isReadOnly()}") > > public void > > set${classGen.cappedProp}($classGen.formatJavaType(${attr.Type}) > > $classGen.formatVariableName(${attr.Name})) { > > // CUSTOM CODE > > $classGen.formatJavaType(${attr.Type}) staro_${attr.Name} = > > ($classGen.formatJavaType(${attr.Type}))readProperty("${attr.Name}"); > > > > writeProperty("${attr.Name}", > > $classGen.formatVariableName(${attr.Name})); > > // CUSTOM CODE > > propertyChangeSupport.firePropertyChange ("${attr.Name}", > > staro_${attr.Name}, ${attr.Name}); > > } > > #end > > public $classGen.formatJavaType(${attr.Type}) get$ > > {classGen.cappedProp}() { > > return ($classGen.formatJavaType(${attr.Type}))readProperty > > ("${attr.Name}"); > > } > > > > > > #end > > ## > > ## Create list add/remove/get methods > > #foreach( $rel in ${classGen.Entity.DeclaredRelationships} ) > > #set( $classGen.Prop = $rel.Name )## let controller know about > > current property > > #if( $rel.ToMany ) > > #if ( ! $rel.ReadOnly ) > > public void > > addTo${classGen.cappedProp}($classGen.formatJavaType($ > > {rel.TargetEntity.ClassName}) > > obj) { > > addToManyTarget("${rel.name}", obj, true); > > } > > public void > > removeFrom${classGen.cappedProp}($classGen.formatJavaType($ > > {rel.TargetEntity.ClassName}) > > obj) { > > removeToManyTarget("${rel.name}", obj, true); > > } > > #end > > public List get${classGen.cappedProp}() { > > return (List)readProperty("${rel.name}"); > > } > > #else > > #if ( !${classGen.getEntity().isReadOnly()} && !$rel.ReadOnly ) > > public void > > set${classGen.cappedProp}($classGen.formatJavaType($ > > {rel.TargetEntity.ClassName}) > > $classGen.formatVariableName(${rel.name})) { > > // SHOULD ADD CUSTOM CODE, TODO > > setToOneTarget("${rel.name}", > > $classGen.formatVariableName(${rel.name}), true); > > } > > #end > > > > public $classGen.formatJavaType(${rel.TargetEntity.ClassName}) > > get${classGen.cappedProp}() { > > return ($classGen.formatJavaType($ > > {rel.TargetEntity.ClassName}))readProperty("${rel.name}"); > > } > > #end > > > > > > #end > > } > >