Re: Many-to-many Help
Re: Many-to-many Help
- Subject: Re: Many-to-many Help
- From: "Jonathan 'Wolf' Rentzsch" <email@hidden>
- Date: Fri, 26 Mar 2004 21:09:14 -0600
James Cicenia, email@hidden, wrote:
>I followed the instructions to the "t" making my many to many
>relationship.
Be aware after you "Join in Many-to-Many" in EOModeler, you need to go
into the generated joining entity and fill out its database mapping
information.
>java.lang.NullPointerException
>[2004-03-26 20:33:54 CST] <WorkerThread5> java.lang.NullPointerException
> at
>com.webobjects.foundation._NSStringUtilities.concat(_NSStringUtilities.j
>ava:213)
> at
>com.webobjects.eoaccess.EOSQLExpression._aliasForRelatedAttributeRelatio
>nshipPath(EOSQLExpression.java:264)
> at
>com.webobjects.eoaccess.EOSQLExpression.joinExpression(EOSQLExpression.j
>ava:1169)
> at
>com.webobjects.eoaccess.EOSQLExpression.prepareSelectExpressionWithAttri
>butes(EOSQLExpression.java:1033)
Looks like EOF is getting an unexpected null string when attempting to
generate the SELECT SQL, so I'm thinking your joining entity attributes
aren't appropriately mapped onto columns.
>list *should* be null as there should be no
>records yet in it. However, it does pass the null test and then
>promptly blows up on the count().
>
>When am I doing wrong?
>
>-James Cicenia
>
> public NSArray theMetricList(){
> System.out.println("before the null test");
> if(theItem.portfolioMetricLists()!=null){
> System.out.println("After the null test");
> System.out.println("the count is:
>"+theItem.portfolioMetricLists().count());
> theMetricList = theItem.portfolioMetricLists();
>
> }
> return theMetricList;
> }
>
>
>before the null test
>After the null test
The test ` if(theItem.portfolioMetricLists()!=null)` doesn't actually
round-trip the database, so that's why you get as far as you do. Instead,
an array fault is returned. The fault fires when you interrogate it with
count(), forcing a database roundtrip, resulting in your SQL generation
error.
| Jonathan 'Wolf' Rentzsch http://rentzsch.com
| Red Shed Software http://redshed.net
| "better" necessarily means "different"
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.