Thread: Re: [Jaxor-devel] Re: Associating Lists
Brought to you by:
mrettig
|
From: Carl F. <car...@gm...> - 2004-08-07 23:46:59
|
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
>
|
|
From: Michael R. <mik...@ya...> - 2004-08-08 02:34:38
|
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
|
|
From: Carl F. <car...@gm...> - 2004-08-08 16:14:13
|
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
>
|
|
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
> >
>
|
|
From: Carl F. <car...@gm...> - 2004-08-09 14:39:46
|
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 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
> > >
> >
>
|
|
From: Michael R. <mik...@ya...> - 2004-08-09 15:26:34
|
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
> 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
>
=== message truncated ===
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
|
|
From: Carl F. <car...@gm...> - 2004-08-10 19:54:15
|
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
> > 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
> >
> === message truncated ===
>
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail
>
|
|
From: Michael R. <mik...@ya...> - 2004-08-12 02:29:43
|
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
|
|
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
>
|
|
From: Carl F. <car...@gm...> - 2004-08-17 04:17:41
|
I think I see why you have avoided this for so long... it is hard to
know exactly what the user is going to want without resorting to the
verbose hibernate style dtd. I am trying to avoid changing the DTD at
all costs and trying to use the api as it exists to achieve the
results we are looking for. The main problem I continue to run into is
that of id generation and other things of that nature (filling in
details of a linking table that don't neccessarily have anything to do
with the links).
Forgetting about the linking table details I would like to throw a
theory out there. Please tell me if this holds water.
If there are entity ref's to multiple tables, the host table can be
thought of as a many to many linking table of some kind.
IE groupmembers has two entity ref's, one to groups, one to users.
This means jaxor should generate a newInstances(group, userList) and a
newInstances(user, groupList) method in the Finder. This is the easy
case.
Now, lets look at adding a third entity ref. I couldn't figure out a
sensible way to model this with users and groups so I am gonna go with
the structure of XML. Say we wanted to create a generic way to store
XML in an RDBMS. We would have tables for documents, elements and
attributes. If this was normalized we would only want one instance for
each element and attribute. So if we go all the way down to the
instance of an attribute we would have something like this:
<jaxor package="net.sourceforge.jaxor.example.xml.jaxor">
<entity name="attribute_instance" alias="AttributeInstance" >
<primary-key>
<column name="attribute_instance_id" type="Long"/>
</primary-key>
<column name="element_instance_id" type="Long"/>
<column name="attribute_id" type="Long"/>
<column name="document_id" type="Long"/>
<entity-ref table="element_instance">
<key source="element_instance_id" target="element_instance_id"/>
</entity-ref>
<entity-ref table="attribute">
<key source="attribute_id" target="attribute_id"/>
</entity-ref>
<entity-ref table="document">
<key source="document_id" target="document_id"/>
</entity-ref>
</entity>
</jaxor>
The attribute instance points to a singular element instance, which in
turns points to a concrete element. The attribute instance also points
to a concrete attribute and document.
In this case, we would want jaxor to generate a bunch of
newInstances() methods.... We are only going to want three:
newInstances(document, attribute, elementInstanceList)
newInstances(document, attributeList, elementInstance)
newInstances(documentList, attribute, elementInstance)
I don't think it really makes sense to pass in more than one List.
Of course it is completely plausible to have a List of groups and a
List of users and you want to put all of the users into all of the
groups, but does that hold true when you have more than two
references?
newInstances(documentList, attribute, elementInstance)
newInstances(document, attributeList, elementInstance)
newInstances(document, attribute, elementInstanceList)
newInstances(document, attributeList, elementInstanceList)
newInstances(documentList, attribute, elementInstanceList)
newInstances(documentList, attributeList, elementInstance)
newInstances(documentList, attributeList, elementInstanceList)
The matrix only grows if we add another entity ref. Not to mention we
still don't have a way to fill in the id's of all of the rows that
will be created...
Does this make sense, and should I move forward with this strategy?
|
|
From: Michael R. <mik...@ya...> - 2004-08-18 04:33:40
|
Yes, it can be complicated. I guess I haven't implemented anything b/c I haven't run across situations where it was difficult to manage manually. The code to manually update fields is trivial. Though transparency has benefits too. Don't worry about changing the DTD. Just change it so the new element or attribute is not required and defaults to the current implementation. I think adding an element or attribute is the only way that this will ever work correctly. It cannot always be automatic. There are always exceptions. Certainly, we need an attribute to turn off automatic relationship management. Your example seems sensible, but would make more sense to me with some unit tests. Do you have a use case from an app you are currently writing? I usually create a unit test that satisfies the requirements of an app I'm working on in the simplest manner possible. Then change the code to meet those requirements. Regards, Mike --- Carl Fyffe <car...@gm...> wrote: > I think I see why you have avoided this for so > long... it is hard to > know exactly what the user is going to want without > resorting to the > verbose hibernate style dtd. I am trying to avoid > changing the DTD at > all costs and trying to use the api as it exists to > achieve the > results we are looking for. The main problem I > continue to run into is > that of id generation and other things of that > nature (filling in > details of a linking table that don't neccessarily > have anything to do > with the links). > > Forgetting about the linking table details I would > like to throw a > theory out there. Please tell me if this holds > water. > > > > If there are entity ref's to multiple tables, the > host table can be > thought of as a many to many linking table of some > kind. > > IE groupmembers has two entity ref's, one to groups, > one to users. > This means jaxor should generate a > newInstances(group, userList) and a > newInstances(user, groupList) method in the Finder. > This is the easy > case. > > Now, lets look at adding a third entity ref. I > couldn't figure out a > sensible way to model this with users and groups so > I am gonna go with > the structure of XML. Say we wanted to create a > generic way to store > XML in an RDBMS. We would have tables for documents, > elements and > attributes. If this was normalized we would only > want one instance for > each element and attribute. So if we go all the way > down to the > instance of an attribute we would have something > like this: > > <jaxor > package="net.sourceforge.jaxor.example.xml.jaxor"> > <entity name="attribute_instance" > alias="AttributeInstance" > > <primary-key> > <column name="attribute_instance_id" > type="Long"/> > </primary-key> > <column name="element_instance_id" > type="Long"/> > <column name="attribute_id" type="Long"/> > <column name="document_id" type="Long"/> > > <entity-ref table="element_instance"> > <key source="element_instance_id" > target="element_instance_id"/> > </entity-ref> > <entity-ref table="attribute"> > <key source="attribute_id" > target="attribute_id"/> > </entity-ref> > <entity-ref table="document"> > <key source="document_id" > target="document_id"/> > </entity-ref> > > </entity> > </jaxor> > > The attribute instance points to a singular element > instance, which in > turns points to a concrete element. The attribute > instance also points > to a concrete attribute and document. > > In this case, we would want jaxor to generate a > bunch of > newInstances() methods.... We are only going to > want three: > > newInstances(document, attribute, > elementInstanceList) > newInstances(document, attributeList, > elementInstance) > newInstances(documentList, attribute, > elementInstance) > > I don't think it really makes sense to pass in more > than one List. > > Of course it is completely plausible to have a List > of groups and a > List of users and you want to put all of the users > into all of the > groups, but does that hold true when you have more > than two > references? > > newInstances(documentList, attribute, > elementInstance) > newInstances(document, attributeList, > elementInstance) > newInstances(document, attribute, > elementInstanceList) > > newInstances(document, attributeList, > elementInstanceList) > newInstances(documentList, attribute, > elementInstanceList) > > newInstances(documentList, attributeList, > elementInstance) > > newInstances(documentList, attributeList, > elementInstanceList) > > The matrix only grows if we add another entity ref. > Not to mention we > still don't have a way to fill in the id's of all of > the rows that > will be created... > > Does this make sense, and should I move forward with > this strategy? > __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail |
|
From: Carl F. <car...@gm...> - 2004-08-24 04:34:47
|
Exciting news. I have the core functionality working. I have bumped into a small conflict where one to many and many to many don't play nicely together. After I figure out the semantics and fix the isForeignKey() method that I introduced for the one to many, we will be in business. I expect to commit this week. It was a good weekend! Hope yours was as good as mine. Carl On Tue, 17 Aug 2004 21:33:33 -0700 (PDT), Michael Rettig <mik...@ya...> wrote: > Yes, it can be complicated. I guess I haven't > implemented anything b/c I haven't run across > situations where it was difficult to manage manually. > The code to manually update fields is trivial. Though > transparency has benefits too. Don't worry about > changing the DTD. Just change it so the new element or > attribute is not required and defaults to the current > implementation. I think adding an element or attribute > is the only way that this will ever work correctly. It > cannot always be automatic. There are always > exceptions. Certainly, we need an attribute to turn > off automatic relationship management. > > Your example seems sensible, but would make more sense > to me with some unit tests. Do you have a use case > from an app you are currently writing? I usually > create a unit test that satisfies the requirements of > an app I'm working on in the simplest manner possible. > Then change the code to meet those requirements. > > Regards, > > Mike > > > > --- Carl Fyffe <car...@gm...> wrote: > > > I think I see why you have avoided this for so > > long... it is hard to > > know exactly what the user is going to want without > > resorting to the > > verbose hibernate style dtd. I am trying to avoid > > changing the DTD at > > all costs and trying to use the api as it exists to > > achieve the > > results we are looking for. The main problem I > > continue to run into is > > that of id generation and other things of that > > nature (filling in > > details of a linking table that don't neccessarily > > have anything to do > > with the links). > > > > Forgetting about the linking table details I would > > like to throw a > > theory out there. Please tell me if this holds > > water. > > > > > > > > If there are entity ref's to multiple tables, the > > host table can be > > thought of as a many to many linking table of some > > kind. > > > > IE groupmembers has two entity ref's, one to groups, > > one to users. > > This means jaxor should generate a > > newInstances(group, userList) and a > > newInstances(user, groupList) method in the Finder. > > This is the easy > > case. > > > > Now, lets look at adding a third entity ref. I > > couldn't figure out a > > sensible way to model this with users and groups so > > I am gonna go with > > the structure of XML. Say we wanted to create a > > generic way to store > > XML in an RDBMS. We would have tables for documents, > > elements and > > attributes. If this was normalized we would only > > want one instance for > > each element and attribute. So if we go all the way > > down to the > > instance of an attribute we would have something > > like this: > > > > <jaxor > > package="net.sourceforge.jaxor.example.xml.jaxor"> > > <entity name="attribute_instance" > > alias="AttributeInstance" > > > <primary-key> > > <column name="attribute_instance_id" > > type="Long"/> > > </primary-key> > > <column name="element_instance_id" > > type="Long"/> > > <column name="attribute_id" type="Long"/> > > <column name="document_id" type="Long"/> > > > > <entity-ref table="element_instance"> > > <key source="element_instance_id" > > target="element_instance_id"/> > > </entity-ref> > > <entity-ref table="attribute"> > > <key source="attribute_id" > > target="attribute_id"/> > > </entity-ref> > > <entity-ref table="document"> > > <key source="document_id" > > target="document_id"/> > > </entity-ref> > > > > </entity> > > </jaxor> > > > > The attribute instance points to a singular element > > instance, which in > > turns points to a concrete element. The attribute > > instance also points > > to a concrete attribute and document. > > > > In this case, we would want jaxor to generate a > > bunch of > > newInstances() methods.... We are only going to > > want three: > > > > newInstances(document, attribute, > > elementInstanceList) > > newInstances(document, attributeList, > > elementInstance) > > newInstances(documentList, attribute, > > elementInstance) > > > > I don't think it really makes sense to pass in more > > than one List. > > > > Of course it is completely plausible to have a List > > of groups and a > > List of users and you want to put all of the users > > into all of the > > groups, but does that hold true when you have more > > than two > > references? > > > > newInstances(documentList, attribute, > > elementInstance) > > newInstances(document, attributeList, > > elementInstance) > > newInstances(document, attribute, > > elementInstanceList) > > > > newInstances(document, attributeList, > > elementInstanceList) > > newInstances(documentList, attribute, > > elementInstanceList) > > > > newInstances(documentList, attributeList, > > elementInstance) > > > > newInstances(documentList, attributeList, > > elementInstanceList) > > > > The matrix only grows if we add another entity ref. > > Not to mention we > > still don't have a way to fill in the id's of all of > > the rows that > > will be created... > > > > Does this make sense, and should I move forward with > > this strategy? > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail - 50x more storage than other providers! > http://promotions.yahoo.com/new_mail > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > > > _______________________________________________ > Jaxor-devel mailing list > Jax...@li... > https://lists.sourceforge.net/lists/listinfo/jaxor-devel > |
|
From: Michael R. <mik...@ya...> - 2004-08-24 22:38:00
|
Exciting news indeed. Drop me an email once you commit and I'll have a look (and write some tests). If everything passes, then we can look at pushing a new beta release. Mike --- Carl Fyffe <car...@gm...> wrote: > Exciting news. I have the core functionality > working. I have bumped > into a small conflict where one to many and many to > many don't play > nicely together. After I figure out the semantics > and fix the > isForeignKey() method that I introduced for the one > to many, we will > be in business. I expect to commit this week. It was > a good weekend! > Hope yours was as good as mine. > > Carl > > On Tue, 17 Aug 2004 21:33:33 -0700 (PDT), Michael > Rettig > <mik...@ya...> wrote: > > Yes, it can be complicated. I guess I haven't > > implemented anything b/c I haven't run across > > situations where it was difficult to manage > manually. > > The code to manually update fields is trivial. > Though > > transparency has benefits too. Don't worry about > > changing the DTD. Just change it so the new > element or > > attribute is not required and defaults to the > current > > implementation. I think adding an element or > attribute > > is the only way that this will ever work > correctly. It > > cannot always be automatic. There are always > > exceptions. Certainly, we need an attribute to > turn > > off automatic relationship management. > > > > Your example seems sensible, but would make more > sense > > to me with some unit tests. Do you have a use case > > from an app you are currently writing? I usually > > create a unit test that satisfies the requirements > of > > an app I'm working on in the simplest manner > possible. > > Then change the code to meet those requirements. > > > > Regards, > > > > Mike > > > > > > > > --- Carl Fyffe <car...@gm...> wrote: > > > > > I think I see why you have avoided this for so > > > long... it is hard to > > > know exactly what the user is going to want > without > > > resorting to the > > > verbose hibernate style dtd. I am trying to > avoid > > > changing the DTD at > > > all costs and trying to use the api as it exists > to > > > achieve the > > > results we are looking for. The main problem I > > > continue to run into is > > > that of id generation and other things of that > > > nature (filling in > > > details of a linking table that don't > neccessarily > > > have anything to do > > > with the links). > > > > > > Forgetting about the linking table details I > would > > > like to throw a > > > theory out there. Please tell me if this holds > > > water. > > > > > > > > > > > > If there are entity ref's to multiple tables, > the > > > host table can be > > > thought of as a many to many linking table of > some > > > kind. > > > > > > IE groupmembers has two entity ref's, one to > groups, > > > one to users. > > > This means jaxor should generate a > > > newInstances(group, userList) and a > > > newInstances(user, groupList) method in the > Finder. > > > This is the easy > > > case. > > > > > > Now, lets look at adding a third entity ref. I > > > couldn't figure out a > > > sensible way to model this with users and groups > so > > > I am gonna go with > > > the structure of XML. Say we wanted to create a > > > generic way to store > > > XML in an RDBMS. We would have tables for > documents, > > > elements and > > > attributes. If this was normalized we would only > > > want one instance for > > > each element and attribute. So if we go all the > way > > > down to the > > > instance of an attribute we would have something > > > like this: > > > > > > <jaxor > > > > package="net.sourceforge.jaxor.example.xml.jaxor"> > > > <entity name="attribute_instance" > > > alias="AttributeInstance" > > > > <primary-key> > > > <column name="attribute_instance_id" > > > type="Long"/> > > > </primary-key> > > > <column name="element_instance_id" > > > type="Long"/> > > > <column name="attribute_id" > type="Long"/> > > > <column name="document_id" type="Long"/> > > > > > > <entity-ref table="element_instance"> > > > <key source="element_instance_id" > > > target="element_instance_id"/> > > > </entity-ref> > > > <entity-ref table="attribute"> > > > <key source="attribute_id" > > > target="attribute_id"/> > > > </entity-ref> > > > <entity-ref table="document"> > > > <key source="document_id" > > > target="document_id"/> > > > </entity-ref> > > > > > > </entity> > > > </jaxor> > > > > > > The attribute instance points to a singular > element > > > instance, which in > > > turns points to a concrete element. The > attribute > > > instance also points > > > to a concrete attribute and document. > > > > > > In this case, we would want jaxor to generate a > > > bunch of > > > newInstances() methods.... We are only going to > > > want three: > > > > > > newInstances(document, attribute, > > > elementInstanceList) > > > newInstances(document, attributeList, > > > elementInstance) > > > newInstances(documentList, attribute, > > > elementInstance) > > > > > > I don't think it really makes sense to pass in > more > > > than one List. > > > > > > Of course it is completely plausible to have a > List > > > of groups and a > > > List of users and you want to put all of the > users > > > into all of the > > > groups, but does that hold true when you have > more > > > than two > > > references? > > > > > > newInstances(documentList, attribute, > > > elementInstance) > > > newInstances(document, attributeList, > > > elementInstance) > > > newInstances(document, attribute, > > > elementInstanceList) > > > > > > newInstances(document, attributeList, > > > elementInstanceList) > > > newInstances(documentList, attribute, > > > elementInstanceList) > > > > > > newInstances(documentList, attributeList, > > > elementInstance) > > > > > > newInstances(documentList, attributeList, > > > elementInstanceList) > === message truncated === __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail |