Todd,
There is a very simple workaround that I mentioned in reply to your
original message
(http://objectstyle.org/cayenne/lists/cayenne-user/2004/08/0154.html) -
just create an ObjRelationship manually in the modeler instead of using
"Sync..." This missing ObjRelationship is actually causing the
exception below.
Andrus
On Sep 8, 2004, at 8:48 PM, Todd O'Bryan wrote:
> After a weekend of illness, too much time spent creating interesting
> problem sets for my intro to programming classes, grading a
> horrendously written quiz that took waaaaay too much time to grade,
> and generally not getting to do any real coding of my own, I'm finally
> back to the problem I mentioned a while ago.
>
> I stuck methods in my classes to handle the relationships the modeler
> didn't create, but I seem to have missed something. Here's the
> exception with the first few objects in the stack trace:
>
> Unable to invoke method postNewMessage on
> org.dupontmanual.web.forum.ShowThread$Enhance_1..ef658[ShowThread]:
> Can't find relationship: poster
> •
>
> org.objectstyle.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObj
> ect.java:358)
> • org.dupontmanual.cayenne.forum.Message.setPoster(Message.java:10)
> •
> org.dupontmanual.web.forum.ShowThread.postNewMessage(ShowThread.java:
> 41)
>
> Here are (what I think are) the relevant parts of Forum.map.xml and
> User.map.xml, the two DataDomain descriptors:
>
> <db-relationship name="poster" source="message" target="user"
> toMany="false">
> <db-attribute-pair source="poster_id" target="id"/>
> </db-relationship>
>
> <db-relationship name="messages" source="user" target="message"
> toMany="true">
> <db-attribute-pair source="id" target="poster_id"/>
> </db-relationship>
>
> And the relevant code that I put in Message.java
>
> public static final String POSTER_PROPERTY = "poster";
>
> public void setPoster(org.dupontmanual.cayenne.users.User poster) {
> setToOneTarget("poster", poster, true);
> }
>
> public org.dupontmanual.cayenne.users.User getPoster() {
> return
> (org.dupontmanual.cayenne.users.User)readProperty("poster");
> }
>
> Anything jump out that I'm doing wrong?
>
> Thanks, especially after such a long time to forget about the original
> problem,
> Todd
>
This archive was generated by hypermail 2.0.0 : Thu Sep 09 2004 - 11:14:44 EDT