Hi Chuck, Miguel and Art,Yup I see what your saying. I think the light just switched on, in fact it did Art's email confirmed it.
As all the way through out the old projects we never had a method called setPersonRelationship, just setPerson we dropped the word Relationship from the template. Doh ! Ohh well looks like its time to hunt down all the cases where we did it the old way and change them to use setAttributeNameRelationship instead.
Thanks guys, I couldn't see the wood for the trees. Owen McKerrow WebMaster, emlab Ph : +61 02 4221 5517 http://emlab.uow.edu.au- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"I like the way this project has somehow, against all common sense, got itself made."
- Peter Jackson, "The Lord of The Rings"
On 05/12/2007, at 10:19 AM, Chuck Hill wrote:
On Dec 4, 2007, at 3:09 PM, Owen McKerrow wrote:Hi All,As part of preparing to move to Eclipse we are going back and updating our projects so they are using packages ( this is the bit where I run and hide in shame as I have to admit we never used them before ) and EOGenerator if they weren't already. Anyways.....We're having some issues, lots of issues so I think we've done something dumb.Yes. :-PThe first issue is that addbjectToBothSidesOfRelationship is now causing a StackOverflow error as it keeps calling itself. In the example below its for the AuditLog class. First up is the old code, then the new code ( thanks to EOGenerator ) and then the error message (I haven't included all of the stack trace as its the same thing over and over again ).So as a newbie to packages I can't see any rules that we're breaking ( although we probably are ). Any advise/suggestions/ fixes would be most appreciated.---Old---- import com.webobjects.foundation.*; import com.webobjects.eocontrol.*; import java.math.BigDecimal; import java.util.*; /** Log trail of each time a page is accessed/viewed on the website. */ public class AccessLog extends OMGenericRecord { public AccessLog() { super(); } public Person person() { return (Person)storedValueForKey("person"); } public void setPerson(Person value) { takeStoredValueForKey(value, "person"); } ----New----- package edu.uow.ris.framework.eo; import edu.uow.ris.framework.*; import edu.uow.emlab.omframework.*; import com.webobjects.eoaccess.*; import com.webobjects.eocontrol.*; import com.webobjects.foundation.*; import java.math.BigDecimal; import java.util.*; import org.apache.log4j.Logger; public abstract class _AccessLog extends OMGenericRecord { private static Logger log = Logger.getLogger( _AccessLog.class ); public _AccessLog() { super(); } public void setPerson(edu.uow.ris.framework.eo.Person aValue) { if( aValue == null ) { edu.uow.ris.framework.eo.Person object = person(); if( object != null )removeObjectFromBothSidesOfRelationshipWithKey ( object, "person" );} elseaddObjectToBothSidesOfRelationshipWithKey( aValue, "person" );}This method should be exactly the same as the original method (other than the signature). Adding packages changes nothing. addObjectToBothSidesOfRelationshipWithKey will result in a call to setPerson. In your case, setPerson then calls addObjectToBothSidesOfRelationshipWithKey which calls setPerson, which calls addObjectToBothSidesOfRelationshipWithKey etc. etc.public void setPerson(edu.uow.ris.framework.eo.Person value) { takeStoredValueForKey(value, "person"); }Chuck --Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.http://www.global-village.net/products/practical_webobjects
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
