Good idea. I still think that there ought to be an easier way -- after 
all, I do this all the time on sites -- but at this point I'll take 
whatever works.

Thanks!

Chas.

Derek Chen-Becker wrote:
> Not much time to properly respond, but make sure to override equals and 
> hashcode on the objects so that to /value-identical/ instances are 
> treated as the same instance. Usually with JPA you're not looking for 
> object equivalence but value equivalence.
> 
> Derek
> 
> On Fri, Jan 9, 2009 at 5:18 PM, Charles F. Munat <c...@munat.com 
> <mailto:c...@munat.com>> wrote:
> 
> 
>     I'm trying to create a way for users to add multiple "worm" objects to
>     an "apple" object in a many-to-many relationship, so I could access them
>     as apple.worms (which returns a Java set, it seems).
> 
>     The first hassle was trying to find the best interface. I rejected a
>     multi-select box because people have a hell of a time with it,
>     especially on an edit where if you forget to hold the Control (Command)
>     key down while selecting, you could delete the previously selected
>     objects.
> 
>     I also rejected a two-box solution where you use left and right arrows
>     to move from the pool of objects to the attached objects (or back
>     again). This also is difficult for some people and a pain to implement.
> 
>     Instead, I like the idea of a simple single item select menu and an Add
>     button using AJAX to add the worm to the apple. To make this simpler, by
>     form is multi-page. You create an apple first, then on the next page you
>     can add worms (and other m-m things). So the AJAX always has a
>     persistent apple to which to add the worms.
> 
>     Better ideas welcome, but this is sufficient.
> 
>     The worms then have a Remove button next to them which permits the
>     association between them and the apple to be deleted.
> 
>     (I also plan a pop-up form that allows one to add new worms from within
>     the apple form.)
> 
>     So now I want to populate the drop down menu with the names of those
>     worms *not already associated with the apple*. My first attempt was by
>     pulling down a set of all the worms (there won't be many) and stuffing
>     it in a val. Then I made a list of all the worms associated with the
>     apple. Then -- heh, heh -- I cleverly subtracted the latter from the
>     former to get the unused worms.
> 
>     Except that it didn't work, of course. They may be the same worms, but
>     the system sees them as two different objects for some reason. Now it's
>     getting complicated. Do I have to compare them on the ID?
> 
>     There must be a better way.
> 
>     So, has anyone done anything like this using JPA/Hibernate and Lift, or
>     am I on my own?
> 
>     Thanks!
> 
>     Chas.
> 
>     P.S. As usual, I need this like yesterday, so I'll continue working
>     on it...
> 
> 
> 
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to