Re: [Jaxor-devel] Re: Associating Lists
Brought to you by:
mrettig
|
From: Carl F. <car...@gm...> - 2004-08-09 05:24:45
|
How do I watch the List to see if it changes? That seems to be what
needs to be done to fix testAddingAnEntityToAListAlreadySetOnEntity()
I keep thinking that a change to List.vm may fix the problem, but I
haven't figured out how. I took a swing and seem to have struck out.
Any pointers for my next time at bat?
On Sun, 8 Aug 2004 12:14:11 -0400, Carl Fyffe <car...@gm...> wrote:
> Thank you! I will get right on them. I also have some news on the ManyToMany.
>
> ManyToMany does not work anything like OneToMany. Yes at the heart it
> is just two OneToMany's pointing in different directions, but they
> point in the wrong directions.
>
> This is REALLY what I want to have work:
> group.setUserList(members);
>
> But that means that UserList will have to know about GroupMember and I
> don't see anyway to make that happen without making a change to the
> DTD and thus the generated .java files. I am trying to avoid that if
> possible.
>
> Next, I tried this:
> GroupMemberEntity gme = new GroupMemberBase();
> gme.setGroupEntity(group);
> gme.setUserList(members);
>
> But like I said earlier, the OneToMany's point in the wrong direction.
> User's don't have one GroupMember, they have lots. So if you have a
> user and you want to set a list of GroupMembers, that works, but we
> have a list of Users. This is the other thought that I have had:
>
> group.setUserList(members, GroupMemberEntity.class);
>
> Pass in some reference that would allow the setter to know what to
> link with. Again that would require a change in the DTD and I think
> the other way is cleaner so I would prefer to go with the other idea
> if I have to change the DTD.
>
> Can you give me a hint at which would be a better "interface" for the developer?
>
> I will start working on your tests and continue thinking about the above.
>
> On Sat, 7 Aug 2004 19:34:30 -0700 (PDT), Michael Rettig
>
>
> <mik...@ya...> wrote:
> > Carl,
> >
> > That was quick. I added a couple new failing tests. If
> > we have a list that is already set on on entity,
> > then we need to set the foreign fields for each entity
> > that is added to the list. Also, if we change the
> > value of the key on the source entity, then we need to
> > update the keys on the list entities.
> >
> > I checked in the tests. Do you want to take a stab at
> > them?
> >
> > --- Carl Fyffe <car...@gm...> wrote:
> >
> > > I have checked the code in for OneToMany. There are
> > > two issues that I
> > > am unhappy about. First, you must have an
> > > <entity-ref> in the .jaxor
> > > of the foreign object (see email.jaxor) and for
> > > setXXXXXList(list) to
> > > work. It throws a SQLValidationException and tells
> > > you that the
> > > column was expected to have a value, but for some
> > > reason this doesn't
> > > "smell" good.
> > >
> > > Second, I have added this method to
> > > ForeignFieldLazyLoader:
> > >
> > > private boolean isForeignKey(EntityRow
> > > targetEntity) {
> > > for(Iterator iterator =
> > > targetEntity.getForeignFields().iterator();
> > > iterator.hasNext();) {
> > > ForeignFieldLazyLoader loader =
> > > (ForeignFieldLazyLoader)
> > > iterator.next();
> > > if (loader.getResolver().isUnique())
> > > return true;
> > > }
> > > return false;
> > > }
> > >
> > > The idea is to find out if the targetEntity is
> > > related to the
> > > sourceEntity. I have tested against ManyToManyTest
> > > and against my new
> > > OneToManyTest and all lights are green. This method
> > > works, and I
> > > don't know why. I was expecting to need to check
> > > directly against the
> > > sourceEntity as well, but apparently I don't.
> > >
> > > The concern is that it will set the list for the
> > > wrong foreign
> > > field... I am sorry if this seems un-smart, but it
> > > seems like magic
> > > to me :-) Can anyone come up with a test that will
> > > cause this method
> > > to return true, thus allowing a save to the wrong
> > > table?
> > >
> > > On Sat, 7 Aug 2004 14:49:55 -0700 (PDT), Michael
> > > Rettig
> > > <mik...@ya...> wrote:
> > > > Carl,
> > > >
> > > > You should have write permissions. I added you to
> > > the
> > > > project as a developer.
> > > >
> > > >
> > >
> > http://sourceforge.net/project/memberlist.php?group_id=59712
> > > >
> > > > Did you checkout the project using ssh?
> > > >
> > > > http://sourceforge.net/cvs/?group_id=59712
> > > >
> > > > Mike
> > > >
> > > > --- Carl Fyffe <car...@gm...> wrote:
> > > >
> > > > > Since a Many to Many is really just a One to
> > > Many on
> > > > > two sides, I
> > > > > thought I would solve the One to Many problem
> > > first.
> > > > > That is done. I
> > > > > would like to check the code in, but I don't
> > > have
> > > > > write permission in
> > > > > the repository.
> > > > >
> > > > > On Sat, 7 Aug 2004 10:08:14 -0700 (PDT), Michael
> > > > > Rettig
> > > > > <mik...@ya...> wrote:
> > > > > >
> > > > > > --- Carl Fyffe <car...@gm...> wrote:
> > > > > >
> > > > > > > Another idea that I have had would be to
> > > start
> > > > > from
> > > > > > > the linking
> > > > > > > object. Put something into the
> > > group_members
> > > > > that
> > > > > > > would allow the
> > > > > > > user to create the links.
> > > > > > >
> > > > > > > GroupMemberFinder.newInstances(group,
> > > userList);
> > > > > > > // or
> > > > > > > GroupMemberFinder.newInstances(user,
> > > groupList);
> > > > > > >
> > > > > > > First would take a list of users and link
> > > them
> > > > > to
> > > > > > > the group, the
> > > > > > > second would take a list of groups and link
> > > to
> > > > > the
> > > > > > > user. What would
> > > > > > > the xml look like to make this happen....
> > > > > > >
> > > > > > > <list-ref table="user_table" type="fk">
> > > > > > > <key source="user_name"/>
> > > > > > > </list-ref>
> > > > > > >
> > > > > > > <list-ref table="groups" type="fk">
> > > > > > > <key source="group_name"/>
> > > > > > > </list-ref>
> > > > > > >
> > > > > > > I like the look of this and will try to get
> > > it
> > > > > > > working this weekend.
> > > > > >
> > > > > > Yes, I like the look of this too. I'm eager
> > > to
> > > > > see it
> > > > > > in action.
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > >
> > > > > > Mike
> > > > > >
> > > > > > __________________________________
> > > > > > Do you Yahoo!?
> > > > > > New and Improved Yahoo! Mail - 100MB free
> > > storage!
> > > > > > http://promotions.yahoo.com/new_mail
> > > > > >
> > > > >
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Take Yahoo! Mail with you! Get it on your mobile
> > > phone.
> > > > http://mobile.yahoo.com/maildemo
> > > >
> > >
> > >
> > >
> > -------------------------------------------------------
> > > This SF.Net email is sponsored by OSTG. Have you
> > > noticed the changes on
> > > Linux.com, ITManagersJournal and NewsForge in the
> > > past few weeks? Now,
> > > one more big change to announce. We are now OSTG-
> > > Open Source Technology
> > > Group. Come see the changes on the new OSTG site.
> > > www.ostg.com
> > > _______________________________________________
> > > Jaxor-devel mailing list
> > > Jax...@li...
> > >
> > https://lists.sourceforge.net/lists/listinfo/jaxor-devel
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Y! Messenger - Communicate in real time. Download now.
> > http://messenger.yahoo.com
> >
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by OSTG. Have you noticed the changes on
> > Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
> > one more big change to announce. We are now OSTG- Open Source Technology
> > Group. Come see the changes on the new OSTG site. www.ostg.com
> > _______________________________________________
> > Jaxor-devel mailing list
> > Jax...@li...
> > https://lists.sourceforge.net/lists/listinfo/jaxor-devel
> >
>
|