Re: [Jaxor-devel] Re: Associating Lists
Brought to you by:
mrettig
From: Carl F. <car...@gm...> - 2004-08-14 18:33:41
|
Checked in the changes that fix changing a list. I am still unsure of the other test's viablity because it is changing a primary key which has cascading issues. Is the goal to have this change perculate through the rest of the lists as well? I can not figure out the use case for changing a primary key... On Wed, 11 Aug 2004 19:29:30 -0700 (PDT), Michael Rettig <mik...@ya...> wrote: > I think the only way to go is to create a wrapper for > the List interface. Use a Decorator to override the > add,addAll, remove, and iterator methods. > > That is the only idea I have. Any alternative ideas? > > Regards, > > Mike > > --- Carl Fyffe <car...@gm...> wrote: > > > I am kinda stuck. I thought about creating a > > wrapper for ArrayList > > but that seemed... smelly. I really want to go the > > ListChangeListener > > route but am a bit stuck on the how... Any pointers > > on what to look at > > to get an idea of how to do this? > > > > On Mon, 9 Aug 2004 08:26:24 -0700 (PDT), Michael > > Rettig > > <mik...@ya...> wrote: > > > This seems like a sensible approach. Though, I > > don't > > > think it should need to implement EntityInterface. > > If > > > it does, then that really smells. > > > > > > You may want to create a new listener interface > > for a > > > list (i.e. ListChangeListener) to listen for > > additions > > > and removals. This would allow you to set/unset > > the > > > keys properly. > > > > > > Mike > > > > > > --- Carl Fyffe <car...@gm...> wrote: > > > > > > > Is the answer to have EntityListAdapterBase > > > > implement ValueChangeListener? > > > > > > > > I am afraid that if that is the answer, then it > > will > > > > also have to > > > > implement EntityInterface. Is that the case? > > > > > > > > On Mon, 9 Aug 2004 01:24:43 -0400, Carl Fyffe > > > > <car...@gm...> wrote: > > > > > 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 > > > === message truncated === > > __________________________________ > Do you Yahoo!? > Yahoo! Mail is new and improved - Check it out! > > > http://promotions.yahoo.com/new_mail > |